diff options
| author | Tony Lindgren <tony@atomide.com> | 2006-04-02 12:46:20 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-04-02 12:46:20 -0400 |
| commit | b824efae120b656fef562b2e81e1ed6aa88f8d24 (patch) | |
| tree | 427d55c6e13fe3b19d2387769145c01933c630d0 | |
| parent | 3267c077e589bc146a0b45e220fcefafbf83fb80 (diff) | |
[ARM] 3426/1: ARM: OMAP: 1/8 Update clock framework
Patch from Tony Lindgren
Update OMAP clock framework from linux-omap tree.
The highlights of the patch are:
- Add support for omap730 clocks by Andrzej Zaborowski
- Fix compile warnings by Dirk Behme
- Add support for using dev id by Tony Lindgren and Komal Shah
- Move memory timings and PRCM into separate files by Tony Lindgren
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/mach-omap1/clock.c | 9 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/clock.h | 91 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/clock.c | 79 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/clock.h | 37 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/memory.c | 102 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/memory.h | 34 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/prcm-regs.h (renamed from arch/arm/mach-omap2/prcm.h) | 188 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/prcm.c | 40 | ||||
| -rw-r--r-- | arch/arm/plat-omap/clock.c | 67 | ||||
| -rw-r--r-- | include/asm-arm/arch-omap/clock.h | 13 | ||||
| -rw-r--r-- | include/asm-arm/arch-omap/prcm.h | 404 | ||||
| -rw-r--r-- | include/asm-arm/arch-omap/system.h | 17 |
12 files changed, 481 insertions, 600 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 75110ba10424..619db18144ea 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
| @@ -345,7 +345,7 @@ static unsigned calc_ext_dsor(unsigned long rate) | |||
| 345 | */ | 345 | */ |
| 346 | for (dsor = 2; dsor < 96; ++dsor) { | 346 | for (dsor = 2; dsor < 96; ++dsor) { |
| 347 | if ((dsor & 1) && dsor > 8) | 347 | if ((dsor & 1) && dsor > 8) |
| 348 | continue; | 348 | continue; |
| 349 | if (rate >= 96000000 / dsor) | 349 | if (rate >= 96000000 / dsor) |
| 350 | break; | 350 | break; |
| 351 | } | 351 | } |
| @@ -687,6 +687,11 @@ int __init omap1_clk_init(void) | |||
| 687 | clk_register(*clkp); | 687 | clk_register(*clkp); |
| 688 | continue; | 688 | continue; |
| 689 | } | 689 | } |
| 690 | |||
| 691 | if (((*clkp)->flags &CLOCK_IN_OMAP310) && cpu_is_omap310()) { | ||
| 692 | clk_register(*clkp); | ||
| 693 | continue; | ||
| 694 | } | ||
| 690 | } | 695 | } |
| 691 | 696 | ||
| 692 | info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); | 697 | info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); |
| @@ -784,7 +789,7 @@ int __init omap1_clk_init(void) | |||
| 784 | clk_enable(&armxor_ck.clk); | 789 | clk_enable(&armxor_ck.clk); |
| 785 | clk_enable(&armtim_ck.clk); /* This should be done by timer code */ | 790 | clk_enable(&armtim_ck.clk); /* This should be done by timer code */ |
| 786 | 791 | ||
| 787 | if (cpu_is_omap1510()) | 792 | if (cpu_is_omap15xx()) |
| 788 | clk_enable(&arm_gpio_ck); | 793 | clk_enable(&arm_gpio_ck); |
| 789 | 794 | ||
| 790 | return 0; | 795 | return 0; |
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index 4f18d1b94449..b7c68819c4e7 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h | |||
| @@ -151,7 +151,7 @@ static struct clk ck_ref = { | |||
| 151 | .name = "ck_ref", | 151 | .name = "ck_ref", |
| 152 | .rate = 12000000, | 152 | .rate = 12000000, |
| 153 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 153 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 154 | ALWAYS_ENABLED, | 154 | CLOCK_IN_OMAP310 | ALWAYS_ENABLED, |
| 155 | .enable = &omap1_clk_enable_generic, | 155 | .enable = &omap1_clk_enable_generic, |
| 156 | .disable = &omap1_clk_disable_generic, | 156 | .disable = &omap1_clk_disable_generic, |
| 157 | }; | 157 | }; |
| @@ -160,7 +160,7 @@ static struct clk ck_dpll1 = { | |||
| 160 | .name = "ck_dpll1", | 160 | .name = "ck_dpll1", |
| 161 | .parent = &ck_ref, | 161 | .parent = &ck_ref, |
| 162 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 162 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 163 | RATE_PROPAGATES | ALWAYS_ENABLED, | 163 | CLOCK_IN_OMAP310 | RATE_PROPAGATES | ALWAYS_ENABLED, |
| 164 | .enable = &omap1_clk_enable_generic, | 164 | .enable = &omap1_clk_enable_generic, |
| 165 | .disable = &omap1_clk_disable_generic, | 165 | .disable = &omap1_clk_disable_generic, |
| 166 | }; | 166 | }; |
| @@ -183,7 +183,8 @@ static struct clk arm_ck = { | |||
| 183 | .name = "arm_ck", | 183 | .name = "arm_ck", |
| 184 | .parent = &ck_dpll1, | 184 | .parent = &ck_dpll1, |
| 185 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 185 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 186 | RATE_CKCTL | RATE_PROPAGATES | ALWAYS_ENABLED, | 186 | CLOCK_IN_OMAP310 | RATE_CKCTL | RATE_PROPAGATES | |
| 187 | ALWAYS_ENABLED, | ||
| 187 | .rate_offset = CKCTL_ARMDIV_OFFSET, | 188 | .rate_offset = CKCTL_ARMDIV_OFFSET, |
| 188 | .recalc = &omap1_ckctl_recalc, | 189 | .recalc = &omap1_ckctl_recalc, |
| 189 | .enable = &omap1_clk_enable_generic, | 190 | .enable = &omap1_clk_enable_generic, |
| @@ -195,7 +196,8 @@ static struct arm_idlect1_clk armper_ck = { | |||
| 195 | .name = "armper_ck", | 196 | .name = "armper_ck", |
| 196 | .parent = &ck_dpll1, | 197 | .parent = &ck_dpll1, |
| 197 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 198 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 198 | RATE_CKCTL | CLOCK_IDLE_CONTROL, | 199 | CLOCK_IN_OMAP310 | RATE_CKCTL | |
| 200 | CLOCK_IDLE_CONTROL, | ||
| 199 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 201 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 200 | .enable_bit = EN_PERCK, | 202 | .enable_bit = EN_PERCK, |
| 201 | .rate_offset = CKCTL_PERDIV_OFFSET, | 203 | .rate_offset = CKCTL_PERDIV_OFFSET, |
| @@ -209,7 +211,7 @@ static struct arm_idlect1_clk armper_ck = { | |||
| 209 | static struct clk arm_gpio_ck = { | 211 | static struct clk arm_gpio_ck = { |
| 210 | .name = "arm_gpio_ck", | 212 | .name = "arm_gpio_ck", |
| 211 | .parent = &ck_dpll1, | 213 | .parent = &ck_dpll1, |
| 212 | .flags = CLOCK_IN_OMAP1510, | 214 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310, |
| 213 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 215 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 214 | .enable_bit = EN_GPIOCK, | 216 | .enable_bit = EN_GPIOCK, |
| 215 | .recalc = &followparent_recalc, | 217 | .recalc = &followparent_recalc, |
| @@ -222,7 +224,7 @@ static struct arm_idlect1_clk armxor_ck = { | |||
| 222 | .name = "armxor_ck", | 224 | .name = "armxor_ck", |
| 223 | .parent = &ck_ref, | 225 | .parent = &ck_ref, |
| 224 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 226 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 225 | CLOCK_IDLE_CONTROL, | 227 | CLOCK_IN_OMAP310 | CLOCK_IDLE_CONTROL, |
| 226 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 228 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 227 | .enable_bit = EN_XORPCK, | 229 | .enable_bit = EN_XORPCK, |
| 228 | .recalc = &followparent_recalc, | 230 | .recalc = &followparent_recalc, |
| @@ -237,7 +239,7 @@ static struct arm_idlect1_clk armtim_ck = { | |||
| 237 | .name = "armtim_ck", | 239 | .name = "armtim_ck", |
| 238 | .parent = &ck_ref, | 240 | .parent = &ck_ref, |
| 239 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 241 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 240 | CLOCK_IDLE_CONTROL, | 242 | CLOCK_IN_OMAP310 | CLOCK_IDLE_CONTROL, |
| 241 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 243 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 242 | .enable_bit = EN_TIMCK, | 244 | .enable_bit = EN_TIMCK, |
| 243 | .recalc = &followparent_recalc, | 245 | .recalc = &followparent_recalc, |
| @@ -252,7 +254,7 @@ static struct arm_idlect1_clk armwdt_ck = { | |||
| 252 | .name = "armwdt_ck", | 254 | .name = "armwdt_ck", |
| 253 | .parent = &ck_ref, | 255 | .parent = &ck_ref, |
| 254 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 256 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 255 | CLOCK_IDLE_CONTROL, | 257 | CLOCK_IN_OMAP310 | CLOCK_IDLE_CONTROL, |
| 256 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 258 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 257 | .enable_bit = EN_WDTCK, | 259 | .enable_bit = EN_WDTCK, |
| 258 | .recalc = &omap1_watchdog_recalc, | 260 | .recalc = &omap1_watchdog_recalc, |
| @@ -344,9 +346,9 @@ static struct arm_idlect1_clk tc_ck = { | |||
| 344 | .name = "tc_ck", | 346 | .name = "tc_ck", |
| 345 | .parent = &ck_dpll1, | 347 | .parent = &ck_dpll1, |
| 346 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 348 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 347 | CLOCK_IN_OMAP730 | RATE_CKCTL | | 349 | CLOCK_IN_OMAP730 | CLOCK_IN_OMAP310 | |
| 348 | RATE_PROPAGATES | ALWAYS_ENABLED | | 350 | RATE_CKCTL | RATE_PROPAGATES | |
| 349 | CLOCK_IDLE_CONTROL, | 351 | ALWAYS_ENABLED | CLOCK_IDLE_CONTROL, |
| 350 | .rate_offset = CKCTL_TCDIV_OFFSET, | 352 | .rate_offset = CKCTL_TCDIV_OFFSET, |
| 351 | .recalc = &omap1_ckctl_recalc, | 353 | .recalc = &omap1_ckctl_recalc, |
| 352 | .enable = &omap1_clk_enable_generic, | 354 | .enable = &omap1_clk_enable_generic, |
| @@ -358,7 +360,8 @@ static struct arm_idlect1_clk tc_ck = { | |||
| 358 | static struct clk arminth_ck1510 = { | 360 | static struct clk arminth_ck1510 = { |
| 359 | .name = "arminth_ck", | 361 | .name = "arminth_ck", |
| 360 | .parent = &tc_ck.clk, | 362 | .parent = &tc_ck.clk, |
| 361 | .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED, | 363 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 364 | ALWAYS_ENABLED, | ||
| 362 | .recalc = &followparent_recalc, | 365 | .recalc = &followparent_recalc, |
| 363 | /* Note: On 1510 the frequency follows TC_CK | 366 | /* Note: On 1510 the frequency follows TC_CK |
| 364 | * | 367 | * |
| @@ -372,7 +375,8 @@ static struct clk tipb_ck = { | |||
| 372 | /* No-idle controlled by "tc_ck" */ | 375 | /* No-idle controlled by "tc_ck" */ |
| 373 | .name = "tibp_ck", | 376 | .name = "tibp_ck", |
| 374 | .parent = &tc_ck.clk, | 377 | .parent = &tc_ck.clk, |
| 375 | .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED, | 378 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 379 | ALWAYS_ENABLED, | ||
| 376 | .recalc = &followparent_recalc, | 380 | .recalc = &followparent_recalc, |
| 377 | .enable = &omap1_clk_enable_generic, | 381 | .enable = &omap1_clk_enable_generic, |
| 378 | .disable = &omap1_clk_disable_generic, | 382 | .disable = &omap1_clk_disable_generic, |
| @@ -417,7 +421,7 @@ static struct clk dma_ck = { | |||
| 417 | .name = "dma_ck", | 421 | .name = "dma_ck", |
| 418 | .parent = &tc_ck.clk, | 422 | .parent = &tc_ck.clk, |
| 419 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 423 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 420 | ALWAYS_ENABLED, | 424 | CLOCK_IN_OMAP310 | ALWAYS_ENABLED, |
| 421 | .recalc = &followparent_recalc, | 425 | .recalc = &followparent_recalc, |
| 422 | .enable = &omap1_clk_enable_generic, | 426 | .enable = &omap1_clk_enable_generic, |
| 423 | .disable = &omap1_clk_disable_generic, | 427 | .disable = &omap1_clk_disable_generic, |
| @@ -437,7 +441,7 @@ static struct arm_idlect1_clk api_ck = { | |||
| 437 | .name = "api_ck", | 441 | .name = "api_ck", |
| 438 | .parent = &tc_ck.clk, | 442 | .parent = &tc_ck.clk, |
| 439 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 443 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 440 | CLOCK_IDLE_CONTROL, | 444 | CLOCK_IN_OMAP310 | CLOCK_IDLE_CONTROL, |
| 441 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 445 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 442 | .enable_bit = EN_APICK, | 446 | .enable_bit = EN_APICK, |
| 443 | .recalc = &followparent_recalc, | 447 | .recalc = &followparent_recalc, |
| @@ -451,7 +455,8 @@ static struct arm_idlect1_clk lb_ck = { | |||
| 451 | .clk = { | 455 | .clk = { |
| 452 | .name = "lb_ck", | 456 | .name = "lb_ck", |
| 453 | .parent = &tc_ck.clk, | 457 | .parent = &tc_ck.clk, |
| 454 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IDLE_CONTROL, | 458 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 459 | CLOCK_IDLE_CONTROL, | ||
| 455 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 460 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 456 | .enable_bit = EN_LBCK, | 461 | .enable_bit = EN_LBCK, |
| 457 | .recalc = &followparent_recalc, | 462 | .recalc = &followparent_recalc, |
| @@ -495,8 +500,8 @@ static struct arm_idlect1_clk lcd_ck_1510 = { | |||
| 495 | .clk = { | 500 | .clk = { |
| 496 | .name = "lcd_ck", | 501 | .name = "lcd_ck", |
| 497 | .parent = &ck_dpll1, | 502 | .parent = &ck_dpll1, |
| 498 | .flags = CLOCK_IN_OMAP1510 | RATE_CKCTL | | 503 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 499 | CLOCK_IDLE_CONTROL, | 504 | RATE_CKCTL | CLOCK_IDLE_CONTROL, |
| 500 | .enable_reg = (void __iomem *)ARM_IDLECT2, | 505 | .enable_reg = (void __iomem *)ARM_IDLECT2, |
| 501 | .enable_bit = EN_LCDCK, | 506 | .enable_bit = EN_LCDCK, |
| 502 | .rate_offset = CKCTL_LCDDIV_OFFSET, | 507 | .rate_offset = CKCTL_LCDDIV_OFFSET, |
| @@ -512,8 +517,9 @@ static struct clk uart1_1510 = { | |||
| 512 | /* Direct from ULPD, no real parent */ | 517 | /* Direct from ULPD, no real parent */ |
| 513 | .parent = &armper_ck.clk, | 518 | .parent = &armper_ck.clk, |
| 514 | .rate = 12000000, | 519 | .rate = 12000000, |
| 515 | .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | | 520 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 516 | ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT, | 521 | ENABLE_REG_32BIT | ALWAYS_ENABLED | |
| 522 | CLOCK_NO_IDLE_PARENT, | ||
| 517 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, | 523 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, |
| 518 | .enable_bit = 29, /* Chooses between 12MHz and 48MHz */ | 524 | .enable_bit = 29, /* Chooses between 12MHz and 48MHz */ |
| 519 | .set_rate = &omap1_set_uart_rate, | 525 | .set_rate = &omap1_set_uart_rate, |
| @@ -544,8 +550,8 @@ static struct clk uart2_ck = { | |||
| 544 | .parent = &armper_ck.clk, | 550 | .parent = &armper_ck.clk, |
| 545 | .rate = 12000000, | 551 | .rate = 12000000, |
| 546 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 552 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 547 | ENABLE_REG_32BIT | ALWAYS_ENABLED | | 553 | CLOCK_IN_OMAP310 | ENABLE_REG_32BIT | |
| 548 | CLOCK_NO_IDLE_PARENT, | 554 | ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT, |
| 549 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, | 555 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, |
| 550 | .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ | 556 | .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ |
| 551 | .set_rate = &omap1_set_uart_rate, | 557 | .set_rate = &omap1_set_uart_rate, |
| @@ -559,8 +565,9 @@ static struct clk uart3_1510 = { | |||
| 559 | /* Direct from ULPD, no real parent */ | 565 | /* Direct from ULPD, no real parent */ |
| 560 | .parent = &armper_ck.clk, | 566 | .parent = &armper_ck.clk, |
| 561 | .rate = 12000000, | 567 | .rate = 12000000, |
| 562 | .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | | 568 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 563 | ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT, | 569 | ENABLE_REG_32BIT | ALWAYS_ENABLED | |
| 570 | CLOCK_NO_IDLE_PARENT, | ||
| 564 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, | 571 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, |
| 565 | .enable_bit = 31, /* Chooses between 12MHz and 48MHz */ | 572 | .enable_bit = 31, /* Chooses between 12MHz and 48MHz */ |
| 566 | .set_rate = &omap1_set_uart_rate, | 573 | .set_rate = &omap1_set_uart_rate, |
| @@ -590,7 +597,7 @@ static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ | |||
| 590 | /* Direct from ULPD, no parent */ | 597 | /* Direct from ULPD, no parent */ |
| 591 | .rate = 6000000, | 598 | .rate = 6000000, |
| 592 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 599 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 593 | RATE_FIXED | ENABLE_REG_32BIT, | 600 | CLOCK_IN_OMAP310 | RATE_FIXED | ENABLE_REG_32BIT, |
| 594 | .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL, | 601 | .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL, |
| 595 | .enable_bit = USB_MCLK_EN_BIT, | 602 | .enable_bit = USB_MCLK_EN_BIT, |
| 596 | .enable = &omap1_clk_enable_generic, | 603 | .enable = &omap1_clk_enable_generic, |
| @@ -601,7 +608,7 @@ static struct clk usb_hhc_ck1510 = { | |||
| 601 | .name = "usb_hhc_ck", | 608 | .name = "usb_hhc_ck", |
| 602 | /* Direct from ULPD, no parent */ | 609 | /* Direct from ULPD, no parent */ |
| 603 | .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ | 610 | .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ |
| 604 | .flags = CLOCK_IN_OMAP1510 | | 611 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | |
| 605 | RATE_FIXED | ENABLE_REG_32BIT, | 612 | RATE_FIXED | ENABLE_REG_32BIT, |
| 606 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, | 613 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, |
| 607 | .enable_bit = USB_HOST_HHC_UHOST_EN, | 614 | .enable_bit = USB_HOST_HHC_UHOST_EN, |
| @@ -637,7 +644,9 @@ static struct clk mclk_1510 = { | |||
| 637 | .name = "mclk", | 644 | .name = "mclk", |
| 638 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 645 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 639 | .rate = 12000000, | 646 | .rate = 12000000, |
| 640 | .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, | 647 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | RATE_FIXED, |
| 648 | .enable_reg = (void __iomem *)SOFT_REQ_REG, | ||
| 649 | .enable_bit = 6, | ||
| 641 | .enable = &omap1_clk_enable_generic, | 650 | .enable = &omap1_clk_enable_generic, |
| 642 | .disable = &omap1_clk_disable_generic, | 651 | .disable = &omap1_clk_disable_generic, |
| 643 | }; | 652 | }; |
| @@ -659,7 +668,7 @@ static struct clk bclk_1510 = { | |||
| 659 | .name = "bclk", | 668 | .name = "bclk", |
| 660 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ | 669 | /* Direct from ULPD, no parent. May be enabled by ext hardware. */ |
| 661 | .rate = 12000000, | 670 | .rate = 12000000, |
| 662 | .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, | 671 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | RATE_FIXED, |
| 663 | .enable = &omap1_clk_enable_generic, | 672 | .enable = &omap1_clk_enable_generic, |
| 664 | .disable = &omap1_clk_disable_generic, | 673 | .disable = &omap1_clk_disable_generic, |
| 665 | }; | 674 | }; |
| @@ -678,12 +687,14 @@ static struct clk bclk_16xx = { | |||
| 678 | }; | 687 | }; |
| 679 | 688 | ||
| 680 | static struct clk mmc1_ck = { | 689 | static struct clk mmc1_ck = { |
| 681 | .name = "mmc1_ck", | 690 | .name = "mmc_ck", |
| 691 | .id = 1, | ||
| 682 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 692 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
| 683 | .parent = &armper_ck.clk, | 693 | .parent = &armper_ck.clk, |
| 684 | .rate = 48000000, | 694 | .rate = 48000000, |
| 685 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 695 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 686 | RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, | 696 | CLOCK_IN_OMAP310 | RATE_FIXED | ENABLE_REG_32BIT | |
| 697 | CLOCK_NO_IDLE_PARENT, | ||
| 687 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, | 698 | .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, |
| 688 | .enable_bit = 23, | 699 | .enable_bit = 23, |
| 689 | .enable = &omap1_clk_enable_generic, | 700 | .enable = &omap1_clk_enable_generic, |
| @@ -691,7 +702,8 @@ static struct clk mmc1_ck = { | |||
| 691 | }; | 702 | }; |
| 692 | 703 | ||
| 693 | static struct clk mmc2_ck = { | 704 | static struct clk mmc2_ck = { |
| 694 | .name = "mmc2_ck", | 705 | .name = "mmc_ck", |
| 706 | .id = 2, | ||
| 695 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 707 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
| 696 | .parent = &armper_ck.clk, | 708 | .parent = &armper_ck.clk, |
| 697 | .rate = 48000000, | 709 | .rate = 48000000, |
| @@ -706,7 +718,7 @@ static struct clk mmc2_ck = { | |||
| 706 | static struct clk virtual_ck_mpu = { | 718 | static struct clk virtual_ck_mpu = { |
| 707 | .name = "mpu", | 719 | .name = "mpu", |
| 708 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | 720 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | |
| 709 | VIRTUAL_CLOCK | ALWAYS_ENABLED, | 721 | CLOCK_IN_OMAP310 | VIRTUAL_CLOCK | ALWAYS_ENABLED, |
| 710 | .parent = &arm_ck, /* Is smarter alias for */ | 722 | .parent = &arm_ck, /* Is smarter alias for */ |
| 711 | .recalc = &followparent_recalc, | 723 | .recalc = &followparent_recalc, |
| 712 | .set_rate = &omap1_select_table_rate, | 724 | .set_rate = &omap1_select_table_rate, |
| @@ -715,6 +727,20 @@ static struct clk virtual_ck_mpu = { | |||
| 715 | .disable = &omap1_clk_disable_generic, | 727 | .disable = &omap1_clk_disable_generic, |
| 716 | }; | 728 | }; |
| 717 | 729 | ||
| 730 | /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK | ||
| 731 | remains active during MPU idle whenever this is enabled */ | ||
| 732 | static struct clk i2c_fck = { | ||
| 733 | .name = "i2c_fck", | ||
| 734 | .id = 1, | ||
| 735 | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | | ||
| 736 | VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT | | ||
| 737 | ALWAYS_ENABLED, | ||
| 738 | .parent = &armxor_ck.clk, | ||
| 739 | .recalc = &followparent_recalc, | ||
| 740 | .enable = &omap1_clk_enable_generic, | ||
| 741 | .disable = &omap1_clk_disable_generic, | ||
| 742 | }; | ||
| 743 | |||
| 718 | static struct clk * onchip_clks[] = { | 744 | static struct clk * onchip_clks[] = { |
| 719 | /* non-ULPD clocks */ | 745 | /* non-ULPD clocks */ |
| 720 | &ck_ref, | 746 | &ck_ref, |
| @@ -763,6 +789,7 @@ static struct clk * onchip_clks[] = { | |||
| 763 | &mmc2_ck, | 789 | &mmc2_ck, |
| 764 | /* Virtual clocks */ | 790 | /* Virtual clocks */ |
| 765 | &virtual_ck_mpu, | 791 | &virtual_ck_mpu, |
| 792 | &i2c_fck, | ||
| 766 | }; | 793 | }; |
| 767 | 794 | ||
| 768 | #endif | 795 | #endif |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 180f675c9064..72eb4bf571ac 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
| @@ -28,14 +28,14 @@ | |||
| 28 | 28 | ||
| 29 | #include <asm/arch/clock.h> | 29 | #include <asm/arch/clock.h> |
| 30 | #include <asm/arch/sram.h> | 30 | #include <asm/arch/sram.h> |
| 31 | #include <asm/arch/prcm.h> | ||
| 32 | 31 | ||
| 32 | #include "prcm-regs.h" | ||
| 33 | #include "memory.h" | ||
| 33 | #include "clock.h" | 34 | #include "clock.h" |
| 34 | 35 | ||
| 35 | //#define DOWN_VARIABLE_DPLL 1 /* Experimental */ | 36 | //#define DOWN_VARIABLE_DPLL 1 /* Experimental */ |
| 36 | 37 | ||
| 37 | static struct prcm_config *curr_prcm_set; | 38 | static struct prcm_config *curr_prcm_set; |
| 38 | static struct memory_timings mem_timings; | ||
| 39 | static u32 curr_perf_level = PRCM_FULL_SPEED; | 39 | static u32 curr_perf_level = PRCM_FULL_SPEED; |
| 40 | 40 | ||
| 41 | /*------------------------------------------------------------------------- | 41 | /*------------------------------------------------------------------------- |
| @@ -54,11 +54,13 @@ static void omap2_sys_clk_recalc(struct clk * clk) | |||
| 54 | 54 | ||
| 55 | static u32 omap2_get_dpll_rate(struct clk * tclk) | 55 | static u32 omap2_get_dpll_rate(struct clk * tclk) |
| 56 | { | 56 | { |
| 57 | int dpll_clk, dpll_mult, dpll_div, amult; | 57 | long long dpll_clk; |
| 58 | int dpll_mult, dpll_div, amult; | ||
| 58 | 59 | ||
| 59 | dpll_mult = (CM_CLKSEL1_PLL >> 12) & 0x03ff; /* 10 bits */ | 60 | dpll_mult = (CM_CLKSEL1_PLL >> 12) & 0x03ff; /* 10 bits */ |
| 60 | dpll_div = (CM_CLKSEL1_PLL >> 8) & 0x0f; /* 4 bits */ | 61 | dpll_div = (CM_CLKSEL1_PLL >> 8) & 0x0f; /* 4 bits */ |
| 61 | dpll_clk = (tclk->parent->rate * dpll_mult) / (dpll_div + 1); | 62 | dpll_clk = (long long)tclk->parent->rate * dpll_mult; |
| 63 | do_div(dpll_clk, dpll_div + 1); | ||
| 62 | amult = CM_CLKSEL2_PLL & 0x3; | 64 | amult = CM_CLKSEL2_PLL & 0x3; |
| 63 | dpll_clk *= amult; | 65 | dpll_clk *= amult; |
| 64 | 66 | ||
| @@ -385,75 +387,23 @@ static u32 omap2_dll_force_needed(void) | |||
| 385 | return 0; | 387 | return 0; |
| 386 | } | 388 | } |
| 387 | 389 | ||
| 388 | static void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | ||
| 389 | { | ||
| 390 | unsigned long dll_cnt; | ||
| 391 | u32 fast_dll = 0; | ||
| 392 | |||
| 393 | mem_timings.m_type = !((SDRC_MR_0 & 0x3) == 0x1); /* DDR = 1, SDR = 0 */ | ||
| 394 | |||
| 395 | /* 2422 es2.05 and beyond has a single SIP DDR instead of 2 like others. | ||
| 396 | * In the case of 2422, its ok to use CS1 instead of CS0. | ||
| 397 | */ | ||
| 398 | |||
| 399 | #if 0 /* FIXME: Enable after 24xx cpu detection works */ | ||
| 400 | ctype = get_cpu_type(); | ||
| 401 | if (cpu_is_omap2422()) | ||
| 402 | mem_timings.base_cs = 1; | ||
| 403 | else | ||
| 404 | #endif | ||
| 405 | mem_timings.base_cs = 0; | ||
| 406 | |||
| 407 | if (mem_timings.m_type != M_DDR) | ||
| 408 | return; | ||
| 409 | |||
| 410 | /* With DDR we need to determine the low frequency DLL value */ | ||
| 411 | if (((mem_timings.fast_dll_ctrl & (1 << 2)) == M_LOCK_CTRL)) | ||
| 412 | mem_timings.dll_mode = M_UNLOCK; | ||
| 413 | else | ||
| 414 | mem_timings.dll_mode = M_LOCK; | ||
| 415 | |||
| 416 | if (mem_timings.base_cs == 0) { | ||
| 417 | fast_dll = SDRC_DLLA_CTRL; | ||
| 418 | dll_cnt = SDRC_DLLA_STATUS & 0xff00; | ||
| 419 | } else { | ||
| 420 | fast_dll = SDRC_DLLB_CTRL; | ||
| 421 | dll_cnt = SDRC_DLLB_STATUS & 0xff00; | ||
| 422 | } | ||
| 423 | if (force_lock_to_unlock_mode) { | ||
| 424 | fast_dll &= ~0xff00; | ||
| 425 | fast_dll |= dll_cnt; /* Current lock mode */ | ||
| 426 | } | ||
| 427 | mem_timings.fast_dll_ctrl = fast_dll; | ||
| 428 | |||
| 429 | /* No disruptions, DDR will be offline & C-ABI not followed */ | ||
| 430 | omap2_sram_ddr_init(&mem_timings.slow_dll_ctrl, | ||
| 431 | mem_timings.fast_dll_ctrl, | ||
| 432 | mem_timings.base_cs, | ||
| 433 | force_lock_to_unlock_mode); | ||
| 434 | mem_timings.slow_dll_ctrl &= 0xff00; /* Keep lock value */ | ||
| 435 | |||
| 436 | /* Turn status into unlock ctrl */ | ||
| 437 | mem_timings.slow_dll_ctrl |= | ||
| 438 | ((mem_timings.fast_dll_ctrl & 0xF) | (1 << 2)); | ||
| 439 | |||
| 440 | /* 90 degree phase for anything below 133Mhz */ | ||
| 441 | mem_timings.slow_dll_ctrl |= (1 << 1); | ||
| 442 | } | ||
| 443 | |||
| 444 | static u32 omap2_reprogram_sdrc(u32 level, u32 force) | 390 | static u32 omap2_reprogram_sdrc(u32 level, u32 force) |
| 445 | { | 391 | { |
| 392 | u32 slow_dll_ctrl, fast_dll_ctrl, m_type; | ||
| 446 | u32 prev = curr_perf_level, flags; | 393 | u32 prev = curr_perf_level, flags; |
| 447 | 394 | ||
| 448 | if ((curr_perf_level == level) && !force) | 395 | if ((curr_perf_level == level) && !force) |
| 449 | return prev; | 396 | return prev; |
| 450 | 397 | ||
| 398 | m_type = omap2_memory_get_type(); | ||
| 399 | slow_dll_ctrl = omap2_memory_get_slow_dll_ctrl(); | ||
| 400 | fast_dll_ctrl = omap2_memory_get_fast_dll_ctrl(); | ||
| 401 | |||
| 451 | if (level == PRCM_HALF_SPEED) { | 402 | if (level == PRCM_HALF_SPEED) { |
| 452 | local_irq_save(flags); | 403 | local_irq_save(flags); |
| 453 | PRCM_VOLTSETUP = 0xffff; | 404 | PRCM_VOLTSETUP = 0xffff; |
| 454 | omap2_sram_reprogram_sdrc(PRCM_HALF_SPEED, | 405 | omap2_sram_reprogram_sdrc(PRCM_HALF_SPEED, |
| 455 | mem_timings.slow_dll_ctrl, | 406 | slow_dll_ctrl, m_type); |
| 456 | mem_timings.m_type); | ||
| 457 | curr_perf_level = PRCM_HALF_SPEED; | 407 | curr_perf_level = PRCM_HALF_SPEED; |
| 458 | local_irq_restore(flags); | 408 | local_irq_restore(flags); |
| 459 | } | 409 | } |
| @@ -461,8 +411,7 @@ static u32 omap2_reprogram_sdrc(u32 level, u32 force) | |||
| 461 | local_irq_save(flags); | 411 | local_irq_save(flags); |
| 462 | PRCM_VOLTSETUP = 0xffff; | 412 | PRCM_VOLTSETUP = 0xffff; |
| 463 | omap2_sram_reprogram_sdrc(PRCM_FULL_SPEED, | 413 | omap2_sram_reprogram_sdrc(PRCM_FULL_SPEED, |
| 464 | mem_timings.fast_dll_ctrl, | 414 | fast_dll_ctrl, m_type); |
| 465 | mem_timings.m_type); | ||
| 466 | curr_perf_level = PRCM_FULL_SPEED; | 415 | curr_perf_level = PRCM_FULL_SPEED; |
| 467 | local_irq_restore(flags); | 416 | local_irq_restore(flags); |
| 468 | } | 417 | } |
| @@ -650,7 +599,7 @@ static u32 omap2_get_clksel(u32 *div_sel, u32 *field_mask, | |||
| 650 | case 13: /* dss2 */ | 599 | case 13: /* dss2 */ |
| 651 | mask = 0x1; break; | 600 | mask = 0x1; break; |
| 652 | case 25: /* usb */ | 601 | case 25: /* usb */ |
| 653 | mask = 0xf; break; | 602 | mask = 0x7; break; |
| 654 | } | 603 | } |
| 655 | } | 604 | } |
| 656 | 605 | ||
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 6cab20b1d3c1..6c78d471fab7 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
| @@ -33,20 +33,6 @@ static u32 omap2_clksel_get_divisor(struct clk *clk); | |||
| 33 | #define RATE_IN_242X (1 << 0) | 33 | #define RATE_IN_242X (1 << 0) |
| 34 | #define RATE_IN_243X (1 << 1) | 34 | #define RATE_IN_243X (1 << 1) |
| 35 | 35 | ||
| 36 | /* Memory timings */ | ||
| 37 | #define M_DDR 1 | ||
| 38 | #define M_LOCK_CTRL (1 << 2) | ||
| 39 | #define M_UNLOCK 0 | ||
| 40 | #define M_LOCK 1 | ||
| 41 | |||
| 42 | struct memory_timings { | ||
| 43 | u32 m_type; /* ddr = 1, sdr = 0 */ | ||
| 44 | u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */ | ||
| 45 | u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */ | ||
| 46 | u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */ | ||
| 47 | u32 base_cs; /* base chip select to use for calculations */ | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | 36 | /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. |
| 51 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP | 37 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP |
| 52 | * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM | 38 | * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM |
| @@ -731,6 +717,16 @@ static struct clk sys_clkout2 = { | |||
| 731 | .recalc = &omap2_clksel_recalc, | 717 | .recalc = &omap2_clksel_recalc, |
| 732 | }; | 718 | }; |
| 733 | 719 | ||
| 720 | static struct clk emul_ck = { | ||
| 721 | .name = "emul_ck", | ||
| 722 | .parent = &func_54m_ck, | ||
| 723 | .flags = CLOCK_IN_OMAP242X, | ||
| 724 | .enable_reg = (void __iomem *)&PRCM_CLKEMUL_CTRL, | ||
| 725 | .enable_bit = 0, | ||
| 726 | .recalc = &omap2_propagate_rate, | ||
| 727 | |||
| 728 | }; | ||
| 729 | |||
| 734 | /* | 730 | /* |
| 735 | * MPU clock domain | 731 | * MPU clock domain |
| 736 | * Clocks: | 732 | * Clocks: |
| @@ -1702,7 +1698,8 @@ static struct clk hdq_fck = { | |||
| 1702 | }; | 1698 | }; |
| 1703 | 1699 | ||
| 1704 | static struct clk i2c2_ick = { | 1700 | static struct clk i2c2_ick = { |
| 1705 | .name = "i2c2_ick", | 1701 | .name = "i2c_ick", |
| 1702 | .id = 2, | ||
| 1706 | .parent = &l4_ck, | 1703 | .parent = &l4_ck, |
| 1707 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | 1704 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, |
| 1708 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | 1705 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, |
| @@ -1711,7 +1708,8 @@ static struct clk i2c2_ick = { | |||
| 1711 | }; | 1708 | }; |
| 1712 | 1709 | ||
| 1713 | static struct clk i2c2_fck = { | 1710 | static struct clk i2c2_fck = { |
| 1714 | .name = "i2c2_fck", | 1711 | .name = "i2c_fck", |
| 1712 | .id = 2, | ||
| 1715 | .parent = &func_12m_ck, | 1713 | .parent = &func_12m_ck, |
| 1716 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | 1714 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, |
| 1717 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | 1715 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, |
| @@ -1729,7 +1727,8 @@ static struct clk i2chs2_fck = { | |||
| 1729 | }; | 1727 | }; |
| 1730 | 1728 | ||
| 1731 | static struct clk i2c1_ick = { | 1729 | static struct clk i2c1_ick = { |
| 1732 | .name = "i2c1_ick", | 1730 | .name = "i2c_ick", |
| 1731 | .id = 1, | ||
| 1733 | .parent = &l4_ck, | 1732 | .parent = &l4_ck, |
| 1734 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | 1733 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, |
| 1735 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, | 1734 | .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, |
| @@ -1738,7 +1737,8 @@ static struct clk i2c1_ick = { | |||
| 1738 | }; | 1737 | }; |
| 1739 | 1738 | ||
| 1740 | static struct clk i2c1_fck = { | 1739 | static struct clk i2c1_fck = { |
| 1741 | .name = "i2c1_fck", | 1740 | .name = "i2c_fck", |
| 1741 | .id = 1, | ||
| 1742 | .parent = &func_12m_ck, | 1742 | .parent = &func_12m_ck, |
| 1743 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, | 1743 | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, |
| 1744 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, | 1744 | .enable_reg = (void __iomem *)&CM_FCLKEN1_CORE, |
| @@ -1971,6 +1971,7 @@ static struct clk *onchip_clks[] = { | |||
| 1971 | &wdt1_osc_ck, | 1971 | &wdt1_osc_ck, |
| 1972 | &sys_clkout, | 1972 | &sys_clkout, |
| 1973 | &sys_clkout2, | 1973 | &sys_clkout2, |
| 1974 | &emul_ck, | ||
| 1974 | /* mpu domain clocks */ | 1975 | /* mpu domain clocks */ |
| 1975 | &mpu_ck, | 1976 | &mpu_ck, |
| 1976 | /* dsp domain clocks */ | 1977 | /* dsp domain clocks */ |
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c new file mode 100644 index 000000000000..1d925d69fc35 --- /dev/null +++ b/arch/arm/mach-omap2/memory.c | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-omap2/memory.c | ||
| 3 | * | ||
| 4 | * Memory timing related functions for OMAP24XX | ||
| 5 | * | ||
| 6 | * Copyright (C) 2005 Texas Instruments Inc. | ||
| 7 | * Richard Woodruff <r-woodruff2@ti.com> | ||
| 8 | * | ||
| 9 | * Copyright (C) 2005 Nokia Corporation | ||
| 10 | * Tony Lindgren <tony@atomide.com> | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License version 2 as | ||
| 14 | * published by the Free Software Foundation. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <linux/config.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/kernel.h> | ||
| 20 | #include <linux/device.h> | ||
| 21 | #include <linux/list.h> | ||
| 22 | #include <linux/errno.h> | ||
| 23 | #include <linux/delay.h> | ||
| 24 | #include <linux/clk.h> | ||
| 25 | |||
| 26 | #include <asm/io.h> | ||
| 27 | |||
| 28 | #include <asm/arch/clock.h> | ||
| 29 | #include <asm/arch/sram.h> | ||
| 30 | |||
| 31 | #include "prcm-regs.h" | ||
| 32 | #include "memory.h" | ||
| 33 | |||
| 34 | static struct memory_timings mem_timings; | ||
| 35 | |||
| 36 | u32 omap2_memory_get_slow_dll_ctrl(void) | ||
| 37 | { | ||
| 38 | return mem_timings.slow_dll_ctrl; | ||
| 39 | } | ||
| 40 | |||
| 41 | u32 omap2_memory_get_fast_dll_ctrl(void) | ||
| 42 | { | ||
| 43 | return mem_timings.fast_dll_ctrl; | ||
| 44 | } | ||
| 45 | |||
| 46 | u32 omap2_memory_get_type(void) | ||
| 47 | { | ||
| 48 | return mem_timings.m_type; | ||
| 49 | } | ||
| 50 | |||
| 51 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | ||
| 52 | { | ||
| 53 | unsigned long dll_cnt; | ||
| 54 | u32 fast_dll = 0; | ||
| 55 | |||
| 56 | mem_timings.m_type = !((SDRC_MR_0 & 0x3) == 0x1); /* DDR = 1, SDR = 0 */ | ||
| 57 | |||
| 58 | /* 2422 es2.05 and beyond has a single SIP DDR instead of 2 like others. | ||
| 59 | * In the case of 2422, its ok to use CS1 instead of CS0. | ||
| 60 | */ | ||
| 61 | if (cpu_is_omap2422()) | ||
| 62 | mem_timings.base_cs = 1; | ||
| 63 | else | ||
| 64 | mem_timings.base_cs = 0; | ||
| 65 | |||
| 66 | if (mem_timings.m_type != M_DDR) | ||
| 67 | return; | ||
| 68 | |||
| 69 | /* With DDR we need to determine the low frequency DLL value */ | ||
| 70 | if (((mem_timings.fast_dll_ctrl & (1 << 2)) == M_LOCK_CTRL)) | ||
| 71 | mem_timings.dll_mode = M_UNLOCK; | ||
| 72 | else | ||
| 73 | mem_timings.dll_mode = M_LOCK; | ||
| 74 | |||
| 75 | if (mem_timings.base_cs == 0) { | ||
| 76 | fast_dll = SDRC_DLLA_CTRL; | ||
| 77 | dll_cnt = SDRC_DLLA_STATUS & 0xff00; | ||
| 78 | } else { | ||
| 79 | fast_dll = SDRC_DLLB_CTRL; | ||
| 80 | dll_cnt = SDRC_DLLB_STATUS & 0xff00; | ||
| 81 | } | ||
| 82 | if (force_lock_to_unlock_mode) { | ||
| 83 | fast_dll &= ~0xff00; | ||
| 84 | fast_dll |= dll_cnt; /* Current lock mode */ | ||
| 85 | } | ||
| 86 | /* set fast timings with DLL filter disabled */ | ||
| 87 | mem_timings.fast_dll_ctrl = (fast_dll | (3 << 8)); | ||
| 88 | |||
| 89 | /* No disruptions, DDR will be offline & C-ABI not followed */ | ||
| 90 | omap2_sram_ddr_init(&mem_timings.slow_dll_ctrl, | ||
| 91 | mem_timings.fast_dll_ctrl, | ||
| 92 | mem_timings.base_cs, | ||
| 93 | force_lock_to_unlock_mode); | ||
| 94 | mem_timings.slow_dll_ctrl &= 0xff00; /* Keep lock value */ | ||
| 95 | |||
| 96 | /* Turn status into unlock ctrl */ | ||
| 97 | mem_timings.slow_dll_ctrl |= | ||
| 98 | ((mem_timings.fast_dll_ctrl & 0xF) | (1 << 2)); | ||
| 99 | |||
| 100 | /* 90 degree phase for anything below 133Mhz + disable DLL filter */ | ||
| 101 | mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); | ||
| 102 | } | ||
diff --git a/arch/arm/mach-omap2/memory.h b/arch/arm/mach-omap2/memory.h new file mode 100644 index 000000000000..d212eea83a05 --- /dev/null +++ b/arch/arm/mach-omap2/memory.h | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-omap2/memory.h | ||
| 3 | * | ||
| 4 | * Interface for memory timing related functions for OMAP24XX | ||
| 5 | * | ||
| 6 | * Copyright (C) 2005 Texas Instruments Inc. | ||
| 7 | * Richard Woodruff <r-woodruff2@ti.com> | ||
| 8 | * | ||
| 9 | * Copyright (C) 2005 Nokia Corporation | ||
| 10 | * Tony Lindgren <tony@atomide.com> | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License version 2 as | ||
| 14 | * published by the Free Software Foundation. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* Memory timings */ | ||
| 18 | #define M_DDR 1 | ||
| 19 | #define M_LOCK_CTRL (1 << 2) | ||
| 20 | #define M_UNLOCK 0 | ||
| 21 | #define M_LOCK 1 | ||
| 22 | |||
| 23 | struct memory_timings { | ||
| 24 | u32 m_type; /* ddr = 1, sdr = 0 */ | ||
| 25 | u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */ | ||
| 26 | u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */ | ||
| 27 | u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */ | ||
| 28 | u32 base_cs; /* base chip select to use for calculations */ | ||
| 29 | }; | ||
| 30 | |||
| 31 | extern void omap2_init_memory_params(u32 force_lock_to_unlock_mode); | ||
| 32 | extern u32 omap2_memory_get_slow_dll_ctrl(void); | ||
| 33 | extern u32 omap2_memory_get_fast_dll_ctrl(void); | ||
| 34 | extern u32 omap2_memory_get_type(void); | ||
diff --git a/arch/arm/mach-omap2/prcm.h b/arch/arm/mach-omap2/prcm-regs.h index 2eb89b936c83..22ac7be4f782 100644 --- a/arch/arm/mach-omap2/prcm.h +++ b/arch/arm/mach-omap2/prcm-regs.h | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * prcm.h - Access definations for use in OMAP24XX clock and power management | 2 | * linux/arch/arm/mach-omap2/prcm-reg.h |
| 3 | * | ||
| 4 | * OMAP24XX Power Reset and Clock Management (PRCM) registers | ||
| 3 | * | 5 | * |
| 4 | * Copyright (C) 2005 Texas Instruments, Inc. | 6 | * Copyright (C) 2005 Texas Instruments, Inc. |
| 5 | * | 7 | * |
| @@ -18,8 +20,8 @@ | |||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ | 21 | */ |
| 20 | 22 | ||
| 21 | #ifndef __ASM_ARM_ARCH_DPM_PRCM_H | 23 | #ifndef __ARCH_ARM_MACH_OMAP2_PRCM_H |
| 22 | #define __ASM_ARM_ARCH_DPM_PRCM_H | 24 | #define __ARCH_ARM_MACH_OMAP2_PRCM_H |
| 23 | 25 | ||
| 24 | /* SET_PERFORMANCE_LEVEL PARAMETERS */ | 26 | /* SET_PERFORMANCE_LEVEL PARAMETERS */ |
| 25 | #define PRCM_HALF_SPEED 1 | 27 | #define PRCM_HALF_SPEED 1 |
| @@ -159,54 +161,63 @@ | |||
| 159 | #define CM_FCLKEN_MDM PRCM_REG32(0xC00) | 161 | #define CM_FCLKEN_MDM PRCM_REG32(0xC00) |
| 160 | #define CM_ICLKEN_MDM PRCM_REG32(0xC10) | 162 | #define CM_ICLKEN_MDM PRCM_REG32(0xC10) |
| 161 | #define CM_IDLEST_MDM PRCM_REG32(0xC20) | 163 | #define CM_IDLEST_MDM PRCM_REG32(0xC20) |
| 164 | #define CM_AUTOIDLE_MDM PRCM_REG32(0xC30) | ||
| 162 | #define CM_CLKSEL_MDM PRCM_REG32(0xC40) | 165 | #define CM_CLKSEL_MDM PRCM_REG32(0xC40) |
| 163 | 166 | #define CM_CLKSTCTRL_MDM PRCM_REG32(0xC48) | |
| 164 | /* FIXME: Move to header for 2430 */ | 167 | #define RM_RSTCTRL_MDM PRCM_REG32(0xC50) |
| 165 | #define DISP_BASE (OMAP24XX_L4_IO_BASE+0x50000) | 168 | #define RM_RSTST_MDM PRCM_REG32(0xC58) |
| 169 | #define PM_WKEN_MDM PRCM_REG32(0xCA0) | ||
| 170 | #define PM_WKST_MDM PRCM_REG32(0xCB0) | ||
| 171 | #define PM_WKDEP_MDM PRCM_REG32(0xCC8) | ||
| 172 | #define PM_PWSTCTRL_MDM PRCM_REG32(0xCE0) | ||
| 173 | #define PM_PWSTST_MDM PRCM_REG32(0xCE4) | ||
| 174 | |||
| 175 | #define OMAP24XX_L4_IO_BASE 0x48000000 | ||
| 176 | |||
| 177 | #define DISP_BASE (OMAP24XX_L4_IO_BASE + 0x50000) | ||
| 166 | #define DISP_REG32(offset) __REG32(DISP_BASE + (offset)) | 178 | #define DISP_REG32(offset) __REG32(DISP_BASE + (offset)) |
| 167 | 179 | ||
| 168 | #define GPMC_BASE (OMAP24XX_GPMC_BASE) | 180 | #define OMAP24XX_GPMC_BASE (L3_24XX_BASE + 0xa000) |
| 169 | #define GPMC_REG32(offset) __REG32(GPMC_BASE + (offset)) | 181 | #define GPMC_REG32(offset) __REG32(OMAP24XX_GPMC_BASE + (offset)) |
| 170 | 182 | ||
| 171 | #define GPT1_BASE (OMAP24XX_GPT1) | 183 | /* FIXME: Move these to timer code */ |
| 184 | #define GPT1_BASE (0x48028000) | ||
| 172 | #define GPT1_REG32(offset) __REG32(GPT1_BASE + (offset)) | 185 | #define GPT1_REG32(offset) __REG32(GPT1_BASE + (offset)) |
| 173 | 186 | ||
| 174 | /* Misc sysconfig */ | 187 | /* Misc sysconfig */ |
| 175 | #define DISPC_SYSCONFIG DISP_REG32(0x410) | 188 | #define DISPC_SYSCONFIG DISP_REG32(0x410) |
| 176 | #define SPI_BASE (OMAP24XX_L4_IO_BASE+0x98000) | 189 | #define SPI_BASE (OMAP24XX_L4_IO_BASE + 0x98000) |
| 177 | #define MCSPI1_SYSCONFIG __REG32(SPI_BASE + 0x10) | 190 | #define MCSPI1_SYSCONFIG __REG32(SPI_BASE + 0x10) |
| 178 | #define MCSPI2_SYSCONFIG __REG32(SPI_BASE+0x2000 + 0x10) | 191 | #define MCSPI2_SYSCONFIG __REG32(SPI_BASE + 0x2000 + 0x10) |
| 179 | 192 | #define MCSPI3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0xb8010) | |
| 180 | //#define DSP_MMU_SYSCONFIG 0x5A000010 | 193 | |
| 181 | #define CAMERA_MMU_SYSCONFIG __REG32(DISP_BASE+0x2C10) | 194 | #define CAMERA_MMU_SYSCONFIG __REG32(DISP_BASE + 0x2C10) |
| 182 | //#define IVA_MMU_SYSCONFIG 0x5D000010 | 195 | #define CAMERA_DMA_SYSCONFIG __REG32(DISP_BASE + 0x282C) |
| 183 | //#define DSP_DMA_SYSCONFIG 0x00FCC02C | 196 | #define SYSTEM_DMA_SYSCONFIG __REG32(DISP_BASE + 0x602C) |
| 184 | #define CAMERA_DMA_SYSCONFIG __REG32(DISP_BASE+0x282C) | ||
| 185 | #define SYSTEM_DMA_SYSCONFIG __REG32(DISP_BASE+0x602C) | ||
| 186 | #define GPMC_SYSCONFIG GPMC_REG32(0x010) | 197 | #define GPMC_SYSCONFIG GPMC_REG32(0x010) |
| 187 | #define MAILBOXES_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x94010) | 198 | #define MAILBOXES_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x94010) |
| 188 | #define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6A054) | 199 | #define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6A054) |
| 189 | #define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6C054) | 200 | #define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6C054) |
| 190 | #define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6E054) | 201 | #define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6E054) |
| 191 | //#define IVA_SYSCONFIG 0x5C060010 | 202 | #define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE + 0x10) |
| 192 | #define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE+0x10) | 203 | #define OMAP24XX_SMS_BASE (L3_24XX_BASE + 0x8000) |
| 193 | #define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE+0x10) | 204 | #define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE + 0x10) |
| 194 | #define SSI_SYSCONFIG __REG32(DISP_BASE+0x8010) | 205 | #define SSI_SYSCONFIG __REG32(DISP_BASE + 0x8010) |
| 195 | //#define VLYNQ_SYSCONFIG 0x67FFFE10 | ||
| 196 | 206 | ||
| 197 | /* rkw - good cannidates for PM_ to start what nm was trying */ | 207 | /* rkw - good cannidates for PM_ to start what nm was trying */ |
| 198 | #define OMAP24XX_GPT2 (OMAP24XX_L4_IO_BASE+0x2A000) | 208 | #define OMAP24XX_GPT2 (OMAP24XX_L4_IO_BASE + 0x2A000) |
| 199 | #define OMAP24XX_GPT3 (OMAP24XX_L4_IO_BASE+0x78000) | 209 | #define OMAP24XX_GPT3 (OMAP24XX_L4_IO_BASE + 0x78000) |
| 200 | #define OMAP24XX_GPT4 (OMAP24XX_L4_IO_BASE+0x7A000) | 210 | #define OMAP24XX_GPT4 (OMAP24XX_L4_IO_BASE + 0x7A000) |
| 201 | #define OMAP24XX_GPT5 (OMAP24XX_L4_IO_BASE+0x7C000) | 211 | #define OMAP24XX_GPT5 (OMAP24XX_L4_IO_BASE + 0x7C000) |
| 202 | #define OMAP24XX_GPT6 (OMAP24XX_L4_IO_BASE+0x7E000) | 212 | #define OMAP24XX_GPT6 (OMAP24XX_L4_IO_BASE + 0x7E000) |
| 203 | #define OMAP24XX_GPT7 (OMAP24XX_L4_IO_BASE+0x80000) | 213 | #define OMAP24XX_GPT7 (OMAP24XX_L4_IO_BASE + 0x80000) |
| 204 | #define OMAP24XX_GPT8 (OMAP24XX_L4_IO_BASE+0x82000) | 214 | #define OMAP24XX_GPT8 (OMAP24XX_L4_IO_BASE + 0x82000) |
| 205 | #define OMAP24XX_GPT9 (OMAP24XX_L4_IO_BASE+0x84000) | 215 | #define OMAP24XX_GPT9 (OMAP24XX_L4_IO_BASE + 0x84000) |
| 206 | #define OMAP24XX_GPT10 (OMAP24XX_L4_IO_BASE+0x86000) | 216 | #define OMAP24XX_GPT10 (OMAP24XX_L4_IO_BASE + 0x86000) |
| 207 | #define OMAP24XX_GPT11 (OMAP24XX_L4_IO_BASE+0x88000) | 217 | #define OMAP24XX_GPT11 (OMAP24XX_L4_IO_BASE + 0x88000) |
| 208 | #define OMAP24XX_GPT12 (OMAP24XX_L4_IO_BASE+0x8A000) | 218 | #define OMAP24XX_GPT12 (OMAP24XX_L4_IO_BASE + 0x8A000) |
| 209 | 219 | ||
| 220 | /* FIXME: Move these to timer code */ | ||
| 210 | #define GPTIMER1_SYSCONFIG GPT1_REG32(0x010) | 221 | #define GPTIMER1_SYSCONFIG GPT1_REG32(0x010) |
| 211 | #define GPTIMER2_SYSCONFIG __REG32(OMAP24XX_GPT2 + 0x10) | 222 | #define GPTIMER2_SYSCONFIG __REG32(OMAP24XX_GPT2 + 0x10) |
| 212 | #define GPTIMER3_SYSCONFIG __REG32(OMAP24XX_GPT3 + 0x10) | 223 | #define GPTIMER3_SYSCONFIG __REG32(OMAP24XX_GPT3 + 0x10) |
| @@ -220,12 +231,18 @@ | |||
| 220 | #define GPTIMER11_SYSCONFIG __REG32(OMAP24XX_GPT11 + 0x10) | 231 | #define GPTIMER11_SYSCONFIG __REG32(OMAP24XX_GPT11 + 0x10) |
| 221 | #define GPTIMER12_SYSCONFIG __REG32(OMAP24XX_GPT12 + 0x10) | 232 | #define GPTIMER12_SYSCONFIG __REG32(OMAP24XX_GPT12 + 0x10) |
| 222 | 233 | ||
| 223 | #define GPIOX_BASE(X) (OMAP24XX_GPIO_BASE+(0x2000*((X)-1))) | 234 | /* FIXME: Move these to gpio code */ |
| 235 | #define OMAP24XX_GPIO_BASE 0x48018000 | ||
| 236 | #define GPIOX_BASE(X) (OMAP24XX_GPIO_BASE + (0x2000 * ((X) - 1))) | ||
| 237 | |||
| 238 | #define GPIO1_SYSCONFIG __REG32((GPIOX_BASE(1) + 0x10)) | ||
| 239 | #define GPIO2_SYSCONFIG __REG32((GPIOX_BASE(2) + 0x10)) | ||
| 240 | #define GPIO3_SYSCONFIG __REG32((GPIOX_BASE(3) + 0x10)) | ||
| 241 | #define GPIO4_SYSCONFIG __REG32((GPIOX_BASE(4) + 0x10)) | ||
| 224 | 242 | ||
| 225 | #define GPIO1_SYSCONFIG __REG32((GPIOX_BASE(1)+0x10)) | 243 | #if defined(CONFIG_ARCH_OMAP243X) |
| 226 | #define GPIO2_SYSCONFIG __REG32((GPIOX_BASE(2)+0x10)) | 244 | #define GPIO5_SYSCONFIG __REG32((OMAP24XX_GPIO5_BASE + 0x10)) |
| 227 | #define GPIO3_SYSCONFIG __REG32((GPIOX_BASE(3)+0x10)) | 245 | #endif |
| 228 | #define GPIO4_SYSCONFIG __REG32((GPIOX_BASE(4)+0x10)) | ||
| 229 | 246 | ||
| 230 | /* GP TIMER 1 */ | 247 | /* GP TIMER 1 */ |
| 231 | #define GPTIMER1_TISTAT GPT1_REG32(0x014) | 248 | #define GPTIMER1_TISTAT GPT1_REG32(0x014) |
| @@ -243,15 +260,15 @@ | |||
| 243 | #define GPTIMER1_TCAR2 GPT1_REG32(0x044) | 260 | #define GPTIMER1_TCAR2 GPT1_REG32(0x044) |
| 244 | 261 | ||
| 245 | /* rkw -- base fix up please... */ | 262 | /* rkw -- base fix up please... */ |
| 246 | #define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE+0x78018) | 263 | #define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE + 0x78018) |
| 247 | 264 | ||
| 248 | /* SDRC */ | 265 | /* SDRC */ |
| 249 | #define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE+0x060) | 266 | #define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x060) |
| 250 | #define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE+0x064) | 267 | #define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x064) |
| 251 | #define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE+0x068) | 268 | #define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x068) |
| 252 | #define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE+0x06C) | 269 | #define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x06C) |
| 253 | #define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE+0x070) | 270 | #define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE + 0x070) |
| 254 | #define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE+0x084) | 271 | #define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE + 0x084) |
| 255 | 272 | ||
| 256 | /* GPIO 1 */ | 273 | /* GPIO 1 */ |
| 257 | #define GPIO1_BASE GPIOX_BASE(1) | 274 | #define GPIO1_BASE GPIOX_BASE(1) |
| @@ -278,6 +295,8 @@ | |||
| 278 | #define GPIO2_DATAIN GPIO2_REG32(0x038) | 295 | #define GPIO2_DATAIN GPIO2_REG32(0x038) |
| 279 | #define GPIO2_OE GPIO2_REG32(0x034) | 296 | #define GPIO2_OE GPIO2_REG32(0x034) |
| 280 | #define GPIO2_DATAOUT GPIO2_REG32(0x03C) | 297 | #define GPIO2_DATAOUT GPIO2_REG32(0x03C) |
| 298 | #define GPIO2_DEBOUNCENABLE GPIO2_REG32(0x050) | ||
| 299 | #define GPIO2_DEBOUNCINGTIME GPIO2_REG32(0x054) | ||
| 281 | 300 | ||
| 282 | /* GPIO 3 */ | 301 | /* GPIO 3 */ |
| 283 | #define GPIO3_BASE GPIOX_BASE(3) | 302 | #define GPIO3_BASE GPIOX_BASE(3) |
| @@ -294,6 +313,8 @@ | |||
| 294 | #define GPIO3_DATAOUT GPIO3_REG32(0x03C) | 313 | #define GPIO3_DATAOUT GPIO3_REG32(0x03C) |
| 295 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | 314 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) |
| 296 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | 315 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) |
| 316 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | ||
| 317 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | ||
| 297 | 318 | ||
| 298 | /* GPIO 4 */ | 319 | /* GPIO 4 */ |
| 299 | #define GPIO4_BASE GPIOX_BASE(4) | 320 | #define GPIO4_BASE GPIOX_BASE(4) |
| @@ -311,10 +332,26 @@ | |||
| 311 | #define GPIO4_DEBOUNCENABLE GPIO4_REG32(0x050) | 332 | #define GPIO4_DEBOUNCENABLE GPIO4_REG32(0x050) |
| 312 | #define GPIO4_DEBOUNCINGTIME GPIO4_REG32(0x054) | 333 | #define GPIO4_DEBOUNCINGTIME GPIO4_REG32(0x054) |
| 313 | 334 | ||
| 335 | #if defined(CONFIG_ARCH_OMAP243X) | ||
| 336 | /* GPIO 5 */ | ||
| 337 | #define GPIO5_REG32(offset) __REG32((OMAP24XX_GPIO5_BASE + (offset))) | ||
| 338 | #define GPIO5_IRQENABLE1 GPIO5_REG32(0x01C) | ||
| 339 | #define GPIO5_IRQSTATUS1 GPIO5_REG32(0x018) | ||
| 340 | #define GPIO5_IRQENABLE2 GPIO5_REG32(0x02C) | ||
| 341 | #define GPIO5_IRQSTATUS2 GPIO5_REG32(0x028) | ||
| 342 | #define GPIO5_WAKEUPENABLE GPIO5_REG32(0x020) | ||
| 343 | #define GPIO5_RISINGDETECT GPIO5_REG32(0x048) | ||
| 344 | #define GPIO5_FALLINGDETECT GPIO5_REG32(0x04C) | ||
| 345 | #define GPIO5_DATAIN GPIO5_REG32(0x038) | ||
| 346 | #define GPIO5_OE GPIO5_REG32(0x034) | ||
| 347 | #define GPIO5_DATAOUT GPIO5_REG32(0x03C) | ||
| 348 | #define GPIO5_DEBOUNCENABLE GPIO5_REG32(0x050) | ||
| 349 | #define GPIO5_DEBOUNCINGTIME GPIO5_REG32(0x054) | ||
| 350 | #endif | ||
| 314 | 351 | ||
| 315 | /* IO CONFIG */ | 352 | /* IO CONFIG */ |
| 316 | #define CONTROL_BASE (OMAP24XX_CTRL_BASE) | 353 | #define OMAP24XX_CTRL_BASE (L4_24XX_BASE) |
| 317 | #define CONTROL_REG32(offset) __REG32(CONTROL_BASE + (offset)) | 354 | #define CONTROL_REG32(offset) __REG32(OMAP24XX_CTRL_BASE + (offset)) |
| 318 | 355 | ||
| 319 | #define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104) | 356 | #define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104) |
| 320 | #define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134) | 357 | #define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134) |
| @@ -322,15 +359,18 @@ | |||
| 322 | #define CONTROL_PADCONF_MCBSP1_DX CONTROL_REG32(0x10C) | 359 | #define CONTROL_PADCONF_MCBSP1_DX CONTROL_REG32(0x10C) |
| 323 | #define CONTROL_PADCONF_GPMC_NCS4 CONTROL_REG32(0x090) | 360 | #define CONTROL_PADCONF_GPMC_NCS4 CONTROL_REG32(0x090) |
| 324 | #define CONTROL_PADCONF_DSS_D5 CONTROL_REG32(0x0B8) | 361 | #define CONTROL_PADCONF_DSS_D5 CONTROL_REG32(0x0B8) |
| 325 | #define CONTROL_PADCONF_DSS_D9 CONTROL_REG32(0x0BC) | 362 | #define CONTROL_PADCONF_DSS_D9 CONTROL_REG32(0x0BC) /* 2420 */ |
| 326 | #define CONTROL_PADCONF_DSS_D13 CONTROL_REG32(0x0C0) | 363 | #define CONTROL_PADCONF_DSS_D13 CONTROL_REG32(0x0C0) |
| 327 | #define CONTROL_PADCONF_DSS_VSYNC CONTROL_REG32(0x0CC) | 364 | #define CONTROL_PADCONF_DSS_VSYNC CONTROL_REG32(0x0CC) |
| 365 | #define CONTROL_PADCONF_SYS_NIRQW0 CONTROL_REG32(0x0BC) /* 2430 */ | ||
| 366 | #define CONTROL_PADCONF_SSI1_FLAG_TX CONTROL_REG32(0x108) /* 2430 */ | ||
| 328 | 367 | ||
| 329 | /* CONTROL */ | 368 | /* CONTROL */ |
| 330 | #define CONTROL_DEVCONF CONTROL_REG32(0x274) | 369 | #define CONTROL_DEVCONF CONTROL_REG32(0x274) |
| 370 | #define CONTROL_DEVCONF1 CONTROL_REG32(0x2E8) | ||
| 331 | 371 | ||
| 332 | /* INTERRUPT CONTROLLER */ | 372 | /* INTERRUPT CONTROLLER */ |
| 333 | #define INTC_BASE (OMAP24XX_L4_IO_BASE+0xfe000) | 373 | #define INTC_BASE ((L4_24XX_BASE) + 0xfe000) |
| 334 | #define INTC_REG32(offset) __REG32(INTC_BASE + (offset)) | 374 | #define INTC_REG32(offset) __REG32(INTC_BASE + (offset)) |
| 335 | 375 | ||
| 336 | #define INTC1_U_BASE INTC_REG32(0x000) | 376 | #define INTC1_U_BASE INTC_REG32(0x000) |
| @@ -348,10 +388,12 @@ | |||
| 348 | #define INTC_ISR_CLEAR2 INTC_REG32(0x0D4) | 388 | #define INTC_ISR_CLEAR2 INTC_REG32(0x0D4) |
| 349 | #define INTC_SIR_IRQ INTC_REG32(0x040) | 389 | #define INTC_SIR_IRQ INTC_REG32(0x040) |
| 350 | #define INTC_CONTROL INTC_REG32(0x048) | 390 | #define INTC_CONTROL INTC_REG32(0x048) |
| 351 | #define INTC_ILR11 INTC_REG32(0x12C) | 391 | #define INTC_ILR11 INTC_REG32(0x12C) /* PRCM on MPU PIC */ |
| 392 | #define INTC_ILR30 INTC_REG32(0x178) | ||
| 393 | #define INTC_ILR31 INTC_REG32(0x17C) | ||
| 352 | #define INTC_ILR32 INTC_REG32(0x180) | 394 | #define INTC_ILR32 INTC_REG32(0x180) |
| 353 | #define INTC_ILR37 INTC_REG32(0x194) | 395 | #define INTC_ILR37 INTC_REG32(0x194) /* GPIO4 on MPU PIC */ |
| 354 | #define INTC_SYSCONFIG INTC_REG32(0x010) | 396 | #define INTC_SYSCONFIG INTC_REG32(0x010) /* GPT1 on MPU PIC */ |
| 355 | 397 | ||
| 356 | /* RAM FIREWALL */ | 398 | /* RAM FIREWALL */ |
| 357 | #define RAMFW_BASE (0x68005000) | 399 | #define RAMFW_BASE (0x68005000) |
| @@ -373,6 +415,24 @@ | |||
| 373 | #define GPMC_CONFIG6_0 GPMC_REG32(0x074) | 415 | #define GPMC_CONFIG6_0 GPMC_REG32(0x074) |
| 374 | #define GPMC_CONFIG7_0 GPMC_REG32(0x078) | 416 | #define GPMC_CONFIG7_0 GPMC_REG32(0x078) |
| 375 | 417 | ||
| 418 | /* GPMC CS1 */ | ||
| 419 | #define GPMC_CONFIG1_1 GPMC_REG32(0x090) | ||
| 420 | #define GPMC_CONFIG2_1 GPMC_REG32(0x094) | ||
| 421 | #define GPMC_CONFIG3_1 GPMC_REG32(0x098) | ||
| 422 | #define GPMC_CONFIG4_1 GPMC_REG32(0x09C) | ||
| 423 | #define GPMC_CONFIG5_1 GPMC_REG32(0x0a0) | ||
| 424 | #define GPMC_CONFIG6_1 GPMC_REG32(0x0a4) | ||
| 425 | #define GPMC_CONFIG7_1 GPMC_REG32(0x0a8) | ||
| 426 | |||
| 427 | /* GPMC CS3 */ | ||
| 428 | #define GPMC_CONFIG1_3 GPMC_REG32(0x0F0) | ||
| 429 | #define GPMC_CONFIG2_3 GPMC_REG32(0x0F4) | ||
| 430 | #define GPMC_CONFIG3_3 GPMC_REG32(0x0F8) | ||
| 431 | #define GPMC_CONFIG4_3 GPMC_REG32(0x0FC) | ||
| 432 | #define GPMC_CONFIG5_3 GPMC_REG32(0x100) | ||
| 433 | #define GPMC_CONFIG6_3 GPMC_REG32(0x104) | ||
| 434 | #define GPMC_CONFIG7_3 GPMC_REG32(0x108) | ||
| 435 | |||
| 376 | /* DSS */ | 436 | /* DSS */ |
| 377 | #define DSS_CONTROL DISP_REG32(0x040) | 437 | #define DSS_CONTROL DISP_REG32(0x040) |
| 378 | #define DISPC_CONTROL DISP_REG32(0x440) | 438 | #define DISPC_CONTROL DISP_REG32(0x440) |
| @@ -405,11 +465,15 @@ | |||
| 405 | #define DISPC_DATA_CYCLE2 DISP_REG32(0x5D8) | 465 | #define DISPC_DATA_CYCLE2 DISP_REG32(0x5D8) |
| 406 | #define DISPC_DATA_CYCLE3 DISP_REG32(0x5DC) | 466 | #define DISPC_DATA_CYCLE3 DISP_REG32(0x5DC) |
| 407 | 467 | ||
| 408 | /* Wake up define for board */ | 468 | /* HSUSB Suspend */ |
| 409 | #define GPIO97 (1 << 1) | 469 | #define HSUSB_CTRL __REG8(0x480AC001) |
| 410 | #define GPIO88 (1 << 24) | 470 | #define USBOTG_POWER __REG32(0x480AC000) |
| 471 | |||
| 472 | /* HS MMC */ | ||
| 473 | #define MMCHS1_SYSCONFIG __REG32(0x4809C010) | ||
| 474 | #define MMCHS2_SYSCONFIG __REG32(0x480b4010) | ||
| 411 | 475 | ||
| 412 | #endif /* __ASSEMBLER__ */ | 476 | #endif /* __ASSEMBLER__ */ |
| 413 | 477 | ||
| 414 | #endif | 478 | #endif |
| 415 | 479 | ||
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c new file mode 100644 index 000000000000..8893479dc7e0 --- /dev/null +++ b/arch/arm/mach-omap2/prcm.c | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-omap2/prcm.c | ||
| 3 | * | ||
| 4 | * OMAP 24xx Power Reset and Clock Management (PRCM) functions | ||
| 5 | * | ||
| 6 | * Copyright (C) 2005 Nokia Corporation | ||
| 7 | * | ||
| 8 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | ||
| 9 | * | ||
| 10 | * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc. | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License version 2 as | ||
| 14 | * published by the Free Software Foundation. | ||
| 15 | */ | ||
| 16 | #include <linux/config.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/init.h> | ||
| 19 | #include <linux/clk.h> | ||
| 20 | |||
| 21 | #include "prcm-regs.h" | ||
| 22 | |||
| 23 | u32 omap_prcm_get_reset_sources(void) | ||
| 24 | { | ||
| 25 | return RM_RSTST_WKUP & 0x7f; | ||
| 26 | } | ||
| 27 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | ||
| 28 | |||
| 29 | /* Resets clock rates and reboots the system. Only called from system.h */ | ||
| 30 | void omap_prcm_arch_reset(char mode) | ||
| 31 | { | ||
| 32 | u32 rate; | ||
| 33 | struct clk *vclk, *sclk; | ||
| 34 | |||
| 35 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
| 36 | sclk = clk_get(NULL, "sys_ck"); | ||
| 37 | rate = clk_get_rate(sclk); | ||
| 38 | clk_set_rate(vclk, rate); /* go to bypass for OMAP limitation */ | ||
| 39 | RM_RSTCTRL_WKUP |= 2; | ||
| 40 | } | ||
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 3c2bfc0efdaf..06485c193ee3 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
| 22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
| 23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/platform_device.h> | ||
| 24 | 25 | ||
| 25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
| 26 | #include <asm/semaphore.h> | 27 | #include <asm/semaphore.h> |
| @@ -37,17 +38,37 @@ static struct clk_functions *arch_clock; | |||
| 37 | * Standard clock functions defined in include/linux/clk.h | 38 | * Standard clock functions defined in include/linux/clk.h |
| 38 | *-------------------------------------------------------------------------*/ | 39 | *-------------------------------------------------------------------------*/ |
| 39 | 40 | ||
| 41 | /* | ||
| 42 | * Returns a clock. Note that we first try to use device id on the bus | ||
| 43 | * and clock name. If this fails, we try to use clock name only. | ||
| 44 | */ | ||
| 40 | struct clk * clk_get(struct device *dev, const char *id) | 45 | struct clk * clk_get(struct device *dev, const char *id) |
| 41 | { | 46 | { |
| 42 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 47 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
| 48 | int idno; | ||
| 49 | |||
| 50 | if (dev == NULL || dev->bus != &platform_bus_type) | ||
| 51 | idno = -1; | ||
| 52 | else | ||
| 53 | idno = to_platform_device(dev)->id; | ||
| 43 | 54 | ||
| 44 | mutex_lock(&clocks_mutex); | 55 | mutex_lock(&clocks_mutex); |
| 56 | |||
| 57 | list_for_each_entry(p, &clocks, node) { | ||
| 58 | if (p->id == idno && | ||
| 59 | strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | ||
| 60 | clk = p; | ||
| 61 | break; | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 45 | list_for_each_entry(p, &clocks, node) { | 65 | list_for_each_entry(p, &clocks, node) { |
| 46 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 66 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
| 47 | clk = p; | 67 | clk = p; |
| 48 | break; | 68 | break; |
| 49 | } | 69 | } |
| 50 | } | 70 | } |
| 71 | |||
| 51 | mutex_unlock(&clocks_mutex); | 72 | mutex_unlock(&clocks_mutex); |
| 52 | 73 | ||
| 53 | return clk; | 74 | return clk; |
| @@ -59,6 +80,9 @@ int clk_enable(struct clk *clk) | |||
| 59 | unsigned long flags; | 80 | unsigned long flags; |
| 60 | int ret = 0; | 81 | int ret = 0; |
| 61 | 82 | ||
| 83 | if (clk == NULL || IS_ERR(clk)) | ||
| 84 | return -EINVAL; | ||
| 85 | |||
| 62 | spin_lock_irqsave(&clockfw_lock, flags); | 86 | spin_lock_irqsave(&clockfw_lock, flags); |
| 63 | if (arch_clock->clk_enable) | 87 | if (arch_clock->clk_enable) |
| 64 | ret = arch_clock->clk_enable(clk); | 88 | ret = arch_clock->clk_enable(clk); |
| @@ -72,6 +96,9 @@ void clk_disable(struct clk *clk) | |||
| 72 | { | 96 | { |
| 73 | unsigned long flags; | 97 | unsigned long flags; |
| 74 | 98 | ||
| 99 | if (clk == NULL || IS_ERR(clk)) | ||
| 100 | return; | ||
| 101 | |||
| 75 | spin_lock_irqsave(&clockfw_lock, flags); | 102 | spin_lock_irqsave(&clockfw_lock, flags); |
| 76 | if (arch_clock->clk_disable) | 103 | if (arch_clock->clk_disable) |
| 77 | arch_clock->clk_disable(clk); | 104 | arch_clock->clk_disable(clk); |
| @@ -84,6 +111,9 @@ int clk_get_usecount(struct clk *clk) | |||
| 84 | unsigned long flags; | 111 | unsigned long flags; |
| 85 | int ret = 0; | 112 | int ret = 0; |
| 86 | 113 | ||
| 114 | if (clk == NULL || IS_ERR(clk)) | ||
| 115 | return 0; | ||
| 116 | |||
| 87 | spin_lock_irqsave(&clockfw_lock, flags); | 117 | spin_lock_irqsave(&clockfw_lock, flags); |
| 88 | ret = clk->usecount; | 118 | ret = clk->usecount; |
| 89 | spin_unlock_irqrestore(&clockfw_lock, flags); | 119 | spin_unlock_irqrestore(&clockfw_lock, flags); |
| @@ -97,6 +127,9 @@ unsigned long clk_get_rate(struct clk *clk) | |||
| 97 | unsigned long flags; | 127 | unsigned long flags; |
| 98 | unsigned long ret = 0; | 128 | unsigned long ret = 0; |
| 99 | 129 | ||
| 130 | if (clk == NULL || IS_ERR(clk)) | ||
| 131 | return 0; | ||
| 132 | |||
| 100 | spin_lock_irqsave(&clockfw_lock, flags); | 133 | spin_lock_irqsave(&clockfw_lock, flags); |
| 101 | ret = clk->rate; | 134 | ret = clk->rate; |
| 102 | spin_unlock_irqrestore(&clockfw_lock, flags); | 135 | spin_unlock_irqrestore(&clockfw_lock, flags); |
| @@ -121,6 +154,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) | |||
| 121 | unsigned long flags; | 154 | unsigned long flags; |
| 122 | long ret = 0; | 155 | long ret = 0; |
| 123 | 156 | ||
| 157 | if (clk == NULL || IS_ERR(clk)) | ||
| 158 | return ret; | ||
| 159 | |||
| 124 | spin_lock_irqsave(&clockfw_lock, flags); | 160 | spin_lock_irqsave(&clockfw_lock, flags); |
| 125 | if (arch_clock->clk_round_rate) | 161 | if (arch_clock->clk_round_rate) |
| 126 | ret = arch_clock->clk_round_rate(clk, rate); | 162 | ret = arch_clock->clk_round_rate(clk, rate); |
| @@ -133,7 +169,10 @@ EXPORT_SYMBOL(clk_round_rate); | |||
| 133 | int clk_set_rate(struct clk *clk, unsigned long rate) | 169 | int clk_set_rate(struct clk *clk, unsigned long rate) |
| 134 | { | 170 | { |
| 135 | unsigned long flags; | 171 | unsigned long flags; |
| 136 | int ret = 0; | 172 | int ret = -EINVAL; |
| 173 | |||
| 174 | if (clk == NULL || IS_ERR(clk)) | ||
| 175 | return ret; | ||
| 137 | 176 | ||
| 138 | spin_lock_irqsave(&clockfw_lock, flags); | 177 | spin_lock_irqsave(&clockfw_lock, flags); |
| 139 | if (arch_clock->clk_set_rate) | 178 | if (arch_clock->clk_set_rate) |
| @@ -147,7 +186,10 @@ EXPORT_SYMBOL(clk_set_rate); | |||
| 147 | int clk_set_parent(struct clk *clk, struct clk *parent) | 186 | int clk_set_parent(struct clk *clk, struct clk *parent) |
| 148 | { | 187 | { |
| 149 | unsigned long flags; | 188 | unsigned long flags; |
| 150 | int ret = 0; | 189 | int ret = -EINVAL; |
| 190 | |||
| 191 | if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent)) | ||
| 192 | return ret; | ||
| 151 | 193 | ||
| 152 | spin_lock_irqsave(&clockfw_lock, flags); | 194 | spin_lock_irqsave(&clockfw_lock, flags); |
| 153 | if (arch_clock->clk_set_parent) | 195 | if (arch_clock->clk_set_parent) |
| @@ -163,6 +205,9 @@ struct clk *clk_get_parent(struct clk *clk) | |||
| 163 | unsigned long flags; | 205 | unsigned long flags; |
| 164 | struct clk * ret = NULL; | 206 | struct clk * ret = NULL; |
| 165 | 207 | ||
| 208 | if (clk == NULL || IS_ERR(clk)) | ||
| 209 | return ret; | ||
| 210 | |||
| 166 | spin_lock_irqsave(&clockfw_lock, flags); | 211 | spin_lock_irqsave(&clockfw_lock, flags); |
| 167 | if (arch_clock->clk_get_parent) | 212 | if (arch_clock->clk_get_parent) |
| 168 | ret = arch_clock->clk_get_parent(clk); | 213 | ret = arch_clock->clk_get_parent(clk); |
| @@ -199,6 +244,9 @@ __setup("mpurate=", omap_clk_setup); | |||
| 199 | /* Used for clocks that always have same value as the parent clock */ | 244 | /* Used for clocks that always have same value as the parent clock */ |
| 200 | void followparent_recalc(struct clk *clk) | 245 | void followparent_recalc(struct clk *clk) |
| 201 | { | 246 | { |
| 247 | if (clk == NULL || IS_ERR(clk)) | ||
| 248 | return; | ||
| 249 | |||
| 202 | clk->rate = clk->parent->rate; | 250 | clk->rate = clk->parent->rate; |
| 203 | } | 251 | } |
| 204 | 252 | ||
| @@ -207,6 +255,9 @@ void propagate_rate(struct clk * tclk) | |||
| 207 | { | 255 | { |
| 208 | struct clk *clkp; | 256 | struct clk *clkp; |
| 209 | 257 | ||
| 258 | if (tclk == NULL || IS_ERR(tclk)) | ||
| 259 | return; | ||
| 260 | |||
| 210 | list_for_each_entry(clkp, &clocks, node) { | 261 | list_for_each_entry(clkp, &clocks, node) { |
| 211 | if (likely(clkp->parent != tclk)) | 262 | if (likely(clkp->parent != tclk)) |
| 212 | continue; | 263 | continue; |
| @@ -217,6 +268,9 @@ void propagate_rate(struct clk * tclk) | |||
| 217 | 268 | ||
| 218 | int clk_register(struct clk *clk) | 269 | int clk_register(struct clk *clk) |
| 219 | { | 270 | { |
| 271 | if (clk == NULL || IS_ERR(clk)) | ||
| 272 | return -EINVAL; | ||
| 273 | |||
| 220 | mutex_lock(&clocks_mutex); | 274 | mutex_lock(&clocks_mutex); |
| 221 | list_add(&clk->node, &clocks); | 275 | list_add(&clk->node, &clocks); |
| 222 | if (clk->init) | 276 | if (clk->init) |
| @@ -229,6 +283,9 @@ EXPORT_SYMBOL(clk_register); | |||
| 229 | 283 | ||
| 230 | void clk_unregister(struct clk *clk) | 284 | void clk_unregister(struct clk *clk) |
| 231 | { | 285 | { |
| 286 | if (clk == NULL || IS_ERR(clk)) | ||
| 287 | return; | ||
| 288 | |||
| 232 | mutex_lock(&clocks_mutex); | 289 | mutex_lock(&clocks_mutex); |
| 233 | list_del(&clk->node); | 290 | list_del(&clk->node); |
| 234 | mutex_unlock(&clocks_mutex); | 291 | mutex_unlock(&clocks_mutex); |
| @@ -239,6 +296,9 @@ void clk_deny_idle(struct clk *clk) | |||
| 239 | { | 296 | { |
| 240 | unsigned long flags; | 297 | unsigned long flags; |
| 241 | 298 | ||
| 299 | if (clk == NULL || IS_ERR(clk)) | ||
| 300 | return; | ||
| 301 | |||
| 242 | spin_lock_irqsave(&clockfw_lock, flags); | 302 | spin_lock_irqsave(&clockfw_lock, flags); |
| 243 | if (arch_clock->clk_deny_idle) | 303 | if (arch_clock->clk_deny_idle) |
| 244 | arch_clock->clk_deny_idle(clk); | 304 | arch_clock->clk_deny_idle(clk); |
| @@ -250,6 +310,9 @@ void clk_allow_idle(struct clk *clk) | |||
| 250 | { | 310 | { |
| 251 | unsigned long flags; | 311 | unsigned long flags; |
| 252 | 312 | ||
| 313 | if (clk == NULL || IS_ERR(clk)) | ||
| 314 | return; | ||
| 315 | |||
| 253 | spin_lock_irqsave(&clockfw_lock, flags); | 316 | spin_lock_irqsave(&clockfw_lock, flags); |
| 254 | if (arch_clock->clk_allow_idle) | 317 | if (arch_clock->clk_allow_idle) |
| 255 | arch_clock->clk_allow_idle(clk); | 318 | arch_clock->clk_allow_idle(clk); |
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h index 46a0402696de..3c4eb9fbe48a 100644 --- a/include/asm-arm/arch-omap/clock.h +++ b/include/asm-arm/arch-omap/clock.h | |||
| @@ -19,6 +19,7 @@ struct clk { | |||
| 19 | struct list_head node; | 19 | struct list_head node; |
| 20 | struct module *owner; | 20 | struct module *owner; |
| 21 | const char *name; | 21 | const char *name; |
| 22 | int id; | ||
| 22 | struct clk *parent; | 23 | struct clk *parent; |
| 23 | unsigned long rate; | 24 | unsigned long rate; |
| 24 | __u32 flags; | 25 | __u32 flags; |
| @@ -57,6 +58,7 @@ extern void propagate_rate(struct clk *clk); | |||
| 57 | extern void followparent_recalc(struct clk * clk); | 58 | extern void followparent_recalc(struct clk * clk); |
| 58 | extern void clk_allow_idle(struct clk *clk); | 59 | extern void clk_allow_idle(struct clk *clk); |
| 59 | extern void clk_deny_idle(struct clk *clk); | 60 | extern void clk_deny_idle(struct clk *clk); |
| 61 | extern int clk_get_usecount(struct clk *clk); | ||
| 60 | 62 | ||
| 61 | /* Clock flags */ | 63 | /* Clock flags */ |
| 62 | #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */ | 64 | #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */ |
| @@ -80,10 +82,11 @@ extern void clk_deny_idle(struct clk *clk); | |||
| 80 | #define CM_PLL_SEL1 (1 << 18) | 82 | #define CM_PLL_SEL1 (1 << 18) |
| 81 | #define CM_PLL_SEL2 (1 << 19) | 83 | #define CM_PLL_SEL2 (1 << 19) |
| 82 | #define CM_SYSCLKOUT_SEL1 (1 << 20) | 84 | #define CM_SYSCLKOUT_SEL1 (1 << 20) |
| 83 | #define CLOCK_IN_OMAP730 (1 << 21) | 85 | #define CLOCK_IN_OMAP310 (1 << 21) |
| 84 | #define CLOCK_IN_OMAP1510 (1 << 22) | 86 | #define CLOCK_IN_OMAP730 (1 << 22) |
| 85 | #define CLOCK_IN_OMAP16XX (1 << 23) | 87 | #define CLOCK_IN_OMAP1510 (1 << 23) |
| 86 | #define CLOCK_IN_OMAP242X (1 << 24) | 88 | #define CLOCK_IN_OMAP16XX (1 << 24) |
| 87 | #define CLOCK_IN_OMAP243X (1 << 25) | 89 | #define CLOCK_IN_OMAP242X (1 << 25) |
| 90 | #define CLOCK_IN_OMAP243X (1 << 26) | ||
| 88 | 91 | ||
| 89 | #endif | 92 | #endif |
diff --git a/include/asm-arm/arch-omap/prcm.h b/include/asm-arm/arch-omap/prcm.h index 7b48a5cbb15f..7bcaf94bde9f 100644 --- a/include/asm-arm/arch-omap/prcm.h +++ b/include/asm-arm/arch-omap/prcm.h | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * prcm.h - Access definations for use in OMAP24XX clock and power management | 2 | * linux/include/asm-arm/arch-omap/prcm.h |
| 3 | * | ||
| 4 | * Access definations for use in OMAP24XX clock and power management | ||
| 3 | * | 5 | * |
| 4 | * Copyright (C) 2005 Texas Instruments, Inc. | 6 | * Copyright (C) 2005 Texas Instruments, Inc. |
| 5 | * | 7 | * |
| @@ -21,405 +23,7 @@ | |||
| 21 | #ifndef __ASM_ARM_ARCH_DPM_PRCM_H | 23 | #ifndef __ASM_ARM_ARCH_DPM_PRCM_H |
| 22 | #define __ASM_ARM_ARCH_DPM_PRCM_H | 24 | #define __ASM_ARM_ARCH_DPM_PRCM_H |
| 23 | 25 | ||
| 24 | /* SET_PERFORMANCE_LEVEL PARAMETERS */ | 26 | u32 omap_prcm_get_reset_sources(void); |
| 25 | #define PRCM_HALF_SPEED 1 | ||
| 26 | #define PRCM_FULL_SPEED 2 | ||
| 27 | |||
| 28 | #ifndef __ASSEMBLER__ | ||
| 29 | |||
| 30 | #define PRCM_REG32(offset) __REG32(OMAP24XX_PRCM_BASE + (offset)) | ||
| 31 | |||
| 32 | #define PRCM_REVISION PRCM_REG32(0x000) | ||
| 33 | #define PRCM_SYSCONFIG PRCM_REG32(0x010) | ||
| 34 | #define PRCM_IRQSTATUS_MPU PRCM_REG32(0x018) | ||
| 35 | #define PRCM_IRQENABLE_MPU PRCM_REG32(0x01C) | ||
| 36 | #define PRCM_VOLTCTRL PRCM_REG32(0x050) | ||
| 37 | #define PRCM_VOLTST PRCM_REG32(0x054) | ||
| 38 | #define PRCM_CLKSRC_CTRL PRCM_REG32(0x060) | ||
| 39 | #define PRCM_CLKOUT_CTRL PRCM_REG32(0x070) | ||
| 40 | #define PRCM_CLKEMUL_CTRL PRCM_REG32(0x078) | ||
| 41 | #define PRCM_CLKCFG_CTRL PRCM_REG32(0x080) | ||
| 42 | #define PRCM_CLKCFG_STATUS PRCM_REG32(0x084) | ||
| 43 | #define PRCM_VOLTSETUP PRCM_REG32(0x090) | ||
| 44 | #define PRCM_CLKSSETUP PRCM_REG32(0x094) | ||
| 45 | #define PRCM_POLCTRL PRCM_REG32(0x098) | ||
| 46 | |||
| 47 | /* GENERAL PURPOSE */ | ||
| 48 | #define GENERAL_PURPOSE1 PRCM_REG32(0x0B0) | ||
| 49 | #define GENERAL_PURPOSE2 PRCM_REG32(0x0B4) | ||
| 50 | #define GENERAL_PURPOSE3 PRCM_REG32(0x0B8) | ||
| 51 | #define GENERAL_PURPOSE4 PRCM_REG32(0x0BC) | ||
| 52 | #define GENERAL_PURPOSE5 PRCM_REG32(0x0C0) | ||
| 53 | #define GENERAL_PURPOSE6 PRCM_REG32(0x0C4) | ||
| 54 | #define GENERAL_PURPOSE7 PRCM_REG32(0x0C8) | ||
| 55 | #define GENERAL_PURPOSE8 PRCM_REG32(0x0CC) | ||
| 56 | #define GENERAL_PURPOSE9 PRCM_REG32(0x0D0) | ||
| 57 | #define GENERAL_PURPOSE10 PRCM_REG32(0x0D4) | ||
| 58 | #define GENERAL_PURPOSE11 PRCM_REG32(0x0D8) | ||
| 59 | #define GENERAL_PURPOSE12 PRCM_REG32(0x0DC) | ||
| 60 | #define GENERAL_PURPOSE13 PRCM_REG32(0x0E0) | ||
| 61 | #define GENERAL_PURPOSE14 PRCM_REG32(0x0E4) | ||
| 62 | #define GENERAL_PURPOSE15 PRCM_REG32(0x0E8) | ||
| 63 | #define GENERAL_PURPOSE16 PRCM_REG32(0x0EC) | ||
| 64 | #define GENERAL_PURPOSE17 PRCM_REG32(0x0F0) | ||
| 65 | #define GENERAL_PURPOSE18 PRCM_REG32(0x0F4) | ||
| 66 | #define GENERAL_PURPOSE19 PRCM_REG32(0x0F8) | ||
| 67 | #define GENERAL_PURPOSE20 PRCM_REG32(0x0FC) | ||
| 68 | |||
| 69 | /* MPU */ | ||
| 70 | #define CM_CLKSEL_MPU PRCM_REG32(0x140) | ||
| 71 | #define CM_CLKSTCTRL_MPU PRCM_REG32(0x148) | ||
| 72 | #define RM_RSTST_MPU PRCM_REG32(0x158) | ||
| 73 | #define PM_WKDEP_MPU PRCM_REG32(0x1C8) | ||
| 74 | #define PM_EVGENCTRL_MPU PRCM_REG32(0x1D4) | ||
| 75 | #define PM_EVEGENONTIM_MPU PRCM_REG32(0x1D8) | ||
| 76 | #define PM_EVEGENOFFTIM_MPU PRCM_REG32(0x1DC) | ||
| 77 | #define PM_PWSTCTRL_MPU PRCM_REG32(0x1E0) | ||
| 78 | #define PM_PWSTST_MPU PRCM_REG32(0x1E4) | ||
| 79 | |||
| 80 | /* CORE */ | ||
| 81 | #define CM_FCLKEN1_CORE PRCM_REG32(0x200) | ||
| 82 | #define CM_FCLKEN2_CORE PRCM_REG32(0x204) | ||
| 83 | #define CM_FCLKEN3_CORE PRCM_REG32(0x208) | ||
| 84 | #define CM_ICLKEN1_CORE PRCM_REG32(0x210) | ||
| 85 | #define CM_ICLKEN2_CORE PRCM_REG32(0x214) | ||
| 86 | #define CM_ICLKEN3_CORE PRCM_REG32(0x218) | ||
| 87 | #define CM_ICLKEN4_CORE PRCM_REG32(0x21C) | ||
| 88 | #define CM_IDLEST1_CORE PRCM_REG32(0x220) | ||
| 89 | #define CM_IDLEST2_CORE PRCM_REG32(0x224) | ||
| 90 | #define CM_IDLEST3_CORE PRCM_REG32(0x228) | ||
| 91 | #define CM_IDLEST4_CORE PRCM_REG32(0x22C) | ||
| 92 | #define CM_AUTOIDLE1_CORE PRCM_REG32(0x230) | ||
| 93 | #define CM_AUTOIDLE2_CORE PRCM_REG32(0x234) | ||
| 94 | #define CM_AUTOIDLE3_CORE PRCM_REG32(0x238) | ||
| 95 | #define CM_AUTOIDLE4_CORE PRCM_REG32(0x23C) | ||
| 96 | #define CM_CLKSEL1_CORE PRCM_REG32(0x240) | ||
| 97 | #define CM_CLKSEL2_CORE PRCM_REG32(0x244) | ||
| 98 | #define CM_CLKSTCTRL_CORE PRCM_REG32(0x248) | ||
| 99 | #define PM_WKEN1_CORE PRCM_REG32(0x2A0) | ||
| 100 | #define PM_WKEN2_CORE PRCM_REG32(0x2A4) | ||
| 101 | #define PM_WKST1_CORE PRCM_REG32(0x2B0) | ||
| 102 | #define PM_WKST2_CORE PRCM_REG32(0x2B4) | ||
| 103 | #define PM_WKDEP_CORE PRCM_REG32(0x2C8) | ||
| 104 | #define PM_PWSTCTRL_CORE PRCM_REG32(0x2E0) | ||
| 105 | #define PM_PWSTST_CORE PRCM_REG32(0x2E4) | ||
| 106 | |||
| 107 | /* GFX */ | ||
| 108 | #define CM_FCLKEN_GFX PRCM_REG32(0x300) | ||
| 109 | #define CM_ICLKEN_GFX PRCM_REG32(0x310) | ||
| 110 | #define CM_IDLEST_GFX PRCM_REG32(0x320) | ||
| 111 | #define CM_CLKSEL_GFX PRCM_REG32(0x340) | ||
| 112 | #define CM_CLKSTCTRL_GFX PRCM_REG32(0x348) | ||
| 113 | #define RM_RSTCTRL_GFX PRCM_REG32(0x350) | ||
| 114 | #define RM_RSTST_GFX PRCM_REG32(0x358) | ||
| 115 | #define PM_WKDEP_GFX PRCM_REG32(0x3C8) | ||
| 116 | #define PM_PWSTCTRL_GFX PRCM_REG32(0x3E0) | ||
| 117 | #define PM_PWSTST_GFX PRCM_REG32(0x3E4) | ||
| 118 | |||
| 119 | /* WAKE-UP */ | ||
| 120 | #define CM_FCLKEN_WKUP PRCM_REG32(0x400) | ||
| 121 | #define CM_ICLKEN_WKUP PRCM_REG32(0x410) | ||
| 122 | #define CM_IDLEST_WKUP PRCM_REG32(0x420) | ||
| 123 | #define CM_AUTOIDLE_WKUP PRCM_REG32(0x430) | ||
| 124 | #define CM_CLKSEL_WKUP PRCM_REG32(0x440) | ||
| 125 | #define RM_RSTCTRL_WKUP PRCM_REG32(0x450) | ||
| 126 | #define RM_RSTTIME_WKUP PRCM_REG32(0x454) | ||
| 127 | #define RM_RSTST_WKUP PRCM_REG32(0x458) | ||
| 128 | #define PM_WKEN_WKUP PRCM_REG32(0x4A0) | ||
| 129 | #define PM_WKST_WKUP PRCM_REG32(0x4B0) | ||
| 130 | |||
| 131 | /* CLOCKS */ | ||
| 132 | #define CM_CLKEN_PLL PRCM_REG32(0x500) | ||
| 133 | #define CM_IDLEST_CKGEN PRCM_REG32(0x520) | ||
| 134 | #define CM_AUTOIDLE_PLL PRCM_REG32(0x530) | ||
| 135 | #define CM_CLKSEL1_PLL PRCM_REG32(0x540) | ||
| 136 | #define CM_CLKSEL2_PLL PRCM_REG32(0x544) | ||
| 137 | |||
| 138 | /* DSP */ | ||
| 139 | #define CM_FCLKEN_DSP PRCM_REG32(0x800) | ||
| 140 | #define CM_ICLKEN_DSP PRCM_REG32(0x810) | ||
| 141 | #define CM_IDLEST_DSP PRCM_REG32(0x820) | ||
| 142 | #define CM_AUTOIDLE_DSP PRCM_REG32(0x830) | ||
| 143 | #define CM_CLKSEL_DSP PRCM_REG32(0x840) | ||
| 144 | #define CM_CLKSTCTRL_DSP PRCM_REG32(0x848) | ||
| 145 | #define RM_RSTCTRL_DSP PRCM_REG32(0x850) | ||
| 146 | #define RM_RSTST_DSP PRCM_REG32(0x858) | ||
| 147 | #define PM_WKEN_DSP PRCM_REG32(0x8A0) | ||
| 148 | #define PM_WKDEP_DSP PRCM_REG32(0x8C8) | ||
| 149 | #define PM_PWSTCTRL_DSP PRCM_REG32(0x8E0) | ||
| 150 | #define PM_PWSTST_DSP PRCM_REG32(0x8E4) | ||
| 151 | #define PRCM_IRQSTATUS_DSP PRCM_REG32(0x8F0) | ||
| 152 | #define PRCM_IRQENABLE_DSP PRCM_REG32(0x8F4) | ||
| 153 | |||
| 154 | /* IVA */ | ||
| 155 | #define PRCM_IRQSTATUS_IVA PRCM_REG32(0x8F8) | ||
| 156 | #define PRCM_IRQENABLE_IVA PRCM_REG32(0x8FC) | ||
| 157 | |||
| 158 | /* Modem on 2430 */ | ||
| 159 | #define CM_FCLKEN_MDM PRCM_REG32(0xC00) | ||
| 160 | #define CM_ICLKEN_MDM PRCM_REG32(0xC10) | ||
| 161 | #define CM_IDLEST_MDM PRCM_REG32(0xC20) | ||
| 162 | #define CM_CLKSEL_MDM PRCM_REG32(0xC40) | ||
| 163 | |||
| 164 | /* FIXME: Move to header for 2430 */ | ||
| 165 | #define DISP_BASE (OMAP24XX_L4_IO_BASE+0x50000) | ||
| 166 | #define DISP_REG32(offset) __REG32(DISP_BASE + (offset)) | ||
| 167 | |||
| 168 | #define OMAP24XX_GPMC_BASE (L3_24XX_BASE + 0xa000) | ||
| 169 | #define GPMC_BASE (OMAP24XX_GPMC_BASE) | ||
| 170 | #define GPMC_REG32(offset) __REG32(GPMC_BASE + (offset)) | ||
| 171 | |||
| 172 | #define GPT1_BASE (OMAP24XX_GPT1) | ||
| 173 | #define GPT1_REG32(offset) __REG32(GPT1_BASE + (offset)) | ||
| 174 | |||
| 175 | /* Misc sysconfig */ | ||
| 176 | #define DISPC_SYSCONFIG DISP_REG32(0x410) | ||
| 177 | #define SPI_BASE (OMAP24XX_L4_IO_BASE+0x98000) | ||
| 178 | #define MCSPI1_SYSCONFIG __REG32(SPI_BASE + 0x10) | ||
| 179 | #define MCSPI2_SYSCONFIG __REG32(SPI_BASE+0x2000 + 0x10) | ||
| 180 | |||
| 181 | //#define DSP_MMU_SYSCONFIG 0x5A000010 | ||
| 182 | #define CAMERA_MMU_SYSCONFIG __REG32(DISP_BASE+0x2C10) | ||
| 183 | //#define IVA_MMU_SYSCONFIG 0x5D000010 | ||
| 184 | //#define DSP_DMA_SYSCONFIG 0x00FCC02C | ||
| 185 | #define CAMERA_DMA_SYSCONFIG __REG32(DISP_BASE+0x282C) | ||
| 186 | #define SYSTEM_DMA_SYSCONFIG __REG32(DISP_BASE+0x602C) | ||
| 187 | #define GPMC_SYSCONFIG GPMC_REG32(0x010) | ||
| 188 | #define MAILBOXES_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x94010) | ||
| 189 | #define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6A054) | ||
| 190 | #define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6C054) | ||
| 191 | #define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE+0x6E054) | ||
| 192 | //#define IVA_SYSCONFIG 0x5C060010 | ||
| 193 | #define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE+0x10) | ||
| 194 | #define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE+0x10) | ||
| 195 | #define SSI_SYSCONFIG __REG32(DISP_BASE+0x8010) | ||
| 196 | //#define VLYNQ_SYSCONFIG 0x67FFFE10 | ||
| 197 | |||
| 198 | /* rkw - good cannidates for PM_ to start what nm was trying */ | ||
| 199 | #define OMAP24XX_GPT2 (OMAP24XX_L4_IO_BASE+0x2A000) | ||
| 200 | #define OMAP24XX_GPT3 (OMAP24XX_L4_IO_BASE+0x78000) | ||
| 201 | #define OMAP24XX_GPT4 (OMAP24XX_L4_IO_BASE+0x7A000) | ||
| 202 | #define OMAP24XX_GPT5 (OMAP24XX_L4_IO_BASE+0x7C000) | ||
| 203 | #define OMAP24XX_GPT6 (OMAP24XX_L4_IO_BASE+0x7E000) | ||
| 204 | #define OMAP24XX_GPT7 (OMAP24XX_L4_IO_BASE+0x80000) | ||
| 205 | #define OMAP24XX_GPT8 (OMAP24XX_L4_IO_BASE+0x82000) | ||
| 206 | #define OMAP24XX_GPT9 (OMAP24XX_L4_IO_BASE+0x84000) | ||
| 207 | #define OMAP24XX_GPT10 (OMAP24XX_L4_IO_BASE+0x86000) | ||
| 208 | #define OMAP24XX_GPT11 (OMAP24XX_L4_IO_BASE+0x88000) | ||
| 209 | #define OMAP24XX_GPT12 (OMAP24XX_L4_IO_BASE+0x8A000) | ||
| 210 | |||
| 211 | #define GPTIMER1_SYSCONFIG GPT1_REG32(0x010) | ||
| 212 | #define GPTIMER2_SYSCONFIG __REG32(OMAP24XX_GPT2 + 0x10) | ||
| 213 | #define GPTIMER3_SYSCONFIG __REG32(OMAP24XX_GPT3 + 0x10) | ||
| 214 | #define GPTIMER4_SYSCONFIG __REG32(OMAP24XX_GPT4 + 0x10) | ||
| 215 | #define GPTIMER5_SYSCONFIG __REG32(OMAP24XX_GPT5 + 0x10) | ||
| 216 | #define GPTIMER6_SYSCONFIG __REG32(OMAP24XX_GPT6 + 0x10) | ||
| 217 | #define GPTIMER7_SYSCONFIG __REG32(OMAP24XX_GPT7 + 0x10) | ||
| 218 | #define GPTIMER8_SYSCONFIG __REG32(OMAP24XX_GPT8 + 0x10) | ||
| 219 | #define GPTIMER9_SYSCONFIG __REG32(OMAP24XX_GPT9 + 0x10) | ||
| 220 | #define GPTIMER10_SYSCONFIG __REG32(OMAP24XX_GPT10 + 0x10) | ||
| 221 | #define GPTIMER11_SYSCONFIG __REG32(OMAP24XX_GPT11 + 0x10) | ||
| 222 | #define GPTIMER12_SYSCONFIG __REG32(OMAP24XX_GPT12 + 0x10) | ||
| 223 | |||
| 224 | #define GPIOX_BASE(X) (OMAP24XX_GPIO_BASE+(0x2000*((X)-1))) | ||
| 225 | |||
| 226 | #define GPIO1_SYSCONFIG __REG32((GPIOX_BASE(1)+0x10)) | ||
| 227 | #define GPIO2_SYSCONFIG __REG32((GPIOX_BASE(2)+0x10)) | ||
| 228 | #define GPIO3_SYSCONFIG __REG32((GPIOX_BASE(3)+0x10)) | ||
| 229 | #define GPIO4_SYSCONFIG __REG32((GPIOX_BASE(4)+0x10)) | ||
| 230 | |||
| 231 | /* GP TIMER 1 */ | ||
| 232 | #define GPTIMER1_TISTAT GPT1_REG32(0x014) | ||
| 233 | #define GPTIMER1_TISR GPT1_REG32(0x018) | ||
| 234 | #define GPTIMER1_TIER GPT1_REG32(0x01C) | ||
| 235 | #define GPTIMER1_TWER GPT1_REG32(0x020) | ||
| 236 | #define GPTIMER1_TCLR GPT1_REG32(0x024) | ||
| 237 | #define GPTIMER1_TCRR GPT1_REG32(0x028) | ||
| 238 | #define GPTIMER1_TLDR GPT1_REG32(0x02C) | ||
| 239 | #define GPTIMER1_TTGR GPT1_REG32(0x030) | ||
| 240 | #define GPTIMER1_TWPS GPT1_REG32(0x034) | ||
| 241 | #define GPTIMER1_TMAR GPT1_REG32(0x038) | ||
| 242 | #define GPTIMER1_TCAR1 GPT1_REG32(0x03C) | ||
| 243 | #define GPTIMER1_TSICR GPT1_REG32(0x040) | ||
| 244 | #define GPTIMER1_TCAR2 GPT1_REG32(0x044) | ||
| 245 | |||
| 246 | /* rkw -- base fix up please... */ | ||
| 247 | #define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE+0x78018) | ||
| 248 | |||
| 249 | /* SDRC */ | ||
| 250 | #define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE+0x060) | ||
| 251 | #define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE+0x064) | ||
| 252 | #define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE+0x068) | ||
| 253 | #define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE+0x06C) | ||
| 254 | #define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE+0x070) | ||
| 255 | #define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE+0x084) | ||
| 256 | |||
| 257 | /* GPIO 1 */ | ||
| 258 | #define GPIO1_BASE GPIOX_BASE(1) | ||
| 259 | #define GPIO1_REG32(offset) __REG32(GPIO1_BASE + (offset)) | ||
| 260 | #define GPIO1_IRQENABLE1 GPIO1_REG32(0x01C) | ||
| 261 | #define GPIO1_IRQSTATUS1 GPIO1_REG32(0x018) | ||
| 262 | #define GPIO1_IRQENABLE2 GPIO1_REG32(0x02C) | ||
| 263 | #define GPIO1_IRQSTATUS2 GPIO1_REG32(0x028) | ||
| 264 | #define GPIO1_WAKEUPENABLE GPIO1_REG32(0x020) | ||
| 265 | #define GPIO1_RISINGDETECT GPIO1_REG32(0x048) | ||
| 266 | #define GPIO1_DATAIN GPIO1_REG32(0x038) | ||
| 267 | #define GPIO1_OE GPIO1_REG32(0x034) | ||
| 268 | #define GPIO1_DATAOUT GPIO1_REG32(0x03C) | ||
| 269 | |||
| 270 | /* GPIO2 */ | ||
| 271 | #define GPIO2_BASE GPIOX_BASE(2) | ||
| 272 | #define GPIO2_REG32(offset) __REG32(GPIO2_BASE + (offset)) | ||
| 273 | #define GPIO2_IRQENABLE1 GPIO2_REG32(0x01C) | ||
| 274 | #define GPIO2_IRQSTATUS1 GPIO2_REG32(0x018) | ||
| 275 | #define GPIO2_IRQENABLE2 GPIO2_REG32(0x02C) | ||
| 276 | #define GPIO2_IRQSTATUS2 GPIO2_REG32(0x028) | ||
| 277 | #define GPIO2_WAKEUPENABLE GPIO2_REG32(0x020) | ||
| 278 | #define GPIO2_RISINGDETECT GPIO2_REG32(0x048) | ||
| 279 | #define GPIO2_DATAIN GPIO2_REG32(0x038) | ||
| 280 | #define GPIO2_OE GPIO2_REG32(0x034) | ||
| 281 | #define GPIO2_DATAOUT GPIO2_REG32(0x03C) | ||
| 282 | |||
| 283 | /* GPIO 3 */ | ||
| 284 | #define GPIO3_BASE GPIOX_BASE(3) | ||
| 285 | #define GPIO3_REG32(offset) __REG32(GPIO3_BASE + (offset)) | ||
| 286 | #define GPIO3_IRQENABLE1 GPIO3_REG32(0x01C) | ||
| 287 | #define GPIO3_IRQSTATUS1 GPIO3_REG32(0x018) | ||
| 288 | #define GPIO3_IRQENABLE2 GPIO3_REG32(0x02C) | ||
| 289 | #define GPIO3_IRQSTATUS2 GPIO3_REG32(0x028) | ||
| 290 | #define GPIO3_WAKEUPENABLE GPIO3_REG32(0x020) | ||
| 291 | #define GPIO3_RISINGDETECT GPIO3_REG32(0x048) | ||
| 292 | #define GPIO3_FALLINGDETECT GPIO3_REG32(0x04C) | ||
| 293 | #define GPIO3_DATAIN GPIO3_REG32(0x038) | ||
| 294 | #define GPIO3_OE GPIO3_REG32(0x034) | ||
| 295 | #define GPIO3_DATAOUT GPIO3_REG32(0x03C) | ||
| 296 | #define GPIO3_DEBOUNCENABLE GPIO3_REG32(0x050) | ||
| 297 | #define GPIO3_DEBOUNCINGTIME GPIO3_REG32(0x054) | ||
| 298 | |||
| 299 | /* GPIO 4 */ | ||
| 300 | #define GPIO4_BASE GPIOX_BASE(4) | ||
| 301 | #define GPIO4_REG32(offset) __REG32(GPIO4_BASE + (offset)) | ||
| 302 | #define GPIO4_IRQENABLE1 GPIO4_REG32(0x01C) | ||
| 303 | #define GPIO4_IRQSTATUS1 GPIO4_REG32(0x018) | ||
| 304 | #define GPIO4_IRQENABLE2 GPIO4_REG32(0x02C) | ||
| 305 | #define GPIO4_IRQSTATUS2 GPIO4_REG32(0x028) | ||
| 306 | #define GPIO4_WAKEUPENABLE GPIO4_REG32(0x020) | ||
| 307 | #define GPIO4_RISINGDETECT GPIO4_REG32(0x048) | ||
| 308 | #define GPIO4_FALLINGDETECT GPIO4_REG32(0x04C) | ||
| 309 | #define GPIO4_DATAIN GPIO4_REG32(0x038) | ||
| 310 | #define GPIO4_OE GPIO4_REG32(0x034) | ||
| 311 | #define GPIO4_DATAOUT GPIO4_REG32(0x03C) | ||
| 312 | #define GPIO4_DEBOUNCENABLE GPIO4_REG32(0x050) | ||
| 313 | #define GPIO4_DEBOUNCINGTIME GPIO4_REG32(0x054) | ||
| 314 | |||
| 315 | |||
| 316 | /* IO CONFIG */ | ||
| 317 | #define CONTROL_BASE (OMAP24XX_CTRL_BASE) | ||
| 318 | #define CONTROL_REG32(offset) __REG32(CONTROL_BASE + (offset)) | ||
| 319 | |||
| 320 | #define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104) | ||
| 321 | #define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134) | ||
| 322 | #define CONTROL_PADCONF_UART1_RX CONTROL_REG32(0x0C8) | ||
| 323 | #define CONTROL_PADCONF_MCBSP1_DX CONTROL_REG32(0x10C) | ||
| 324 | #define CONTROL_PADCONF_GPMC_NCS4 CONTROL_REG32(0x090) | ||
| 325 | #define CONTROL_PADCONF_DSS_D5 CONTROL_REG32(0x0B8) | ||
| 326 | #define CONTROL_PADCONF_DSS_D9 CONTROL_REG32(0x0BC) | ||
| 327 | #define CONTROL_PADCONF_DSS_D13 CONTROL_REG32(0x0C0) | ||
| 328 | #define CONTROL_PADCONF_DSS_VSYNC CONTROL_REG32(0x0CC) | ||
| 329 | |||
| 330 | /* CONTROL */ | ||
| 331 | #define CONTROL_DEVCONF CONTROL_REG32(0x274) | ||
| 332 | |||
| 333 | /* INTERRUPT CONTROLLER */ | ||
| 334 | #define INTC_BASE (OMAP24XX_L4_IO_BASE+0xfe000) | ||
| 335 | #define INTC_REG32(offset) __REG32(INTC_BASE + (offset)) | ||
| 336 | |||
| 337 | #define INTC1_U_BASE INTC_REG32(0x000) | ||
| 338 | #define INTC_MIR0 INTC_REG32(0x084) | ||
| 339 | #define INTC_MIR_SET0 INTC_REG32(0x08C) | ||
| 340 | #define INTC_MIR_CLEAR0 INTC_REG32(0x088) | ||
| 341 | #define INTC_ISR_CLEAR0 INTC_REG32(0x094) | ||
| 342 | #define INTC_MIR1 INTC_REG32(0x0A4) | ||
| 343 | #define INTC_MIR_SET1 INTC_REG32(0x0AC) | ||
| 344 | #define INTC_MIR_CLEAR1 INTC_REG32(0x0A8) | ||
| 345 | #define INTC_ISR_CLEAR1 INTC_REG32(0x0B4) | ||
| 346 | #define INTC_MIR2 INTC_REG32(0x0C4) | ||
| 347 | #define INTC_MIR_SET2 INTC_REG32(0x0CC) | ||
| 348 | #define INTC_MIR_CLEAR2 INTC_REG32(0x0C8) | ||
| 349 | #define INTC_ISR_CLEAR2 INTC_REG32(0x0D4) | ||
| 350 | #define INTC_SIR_IRQ INTC_REG32(0x040) | ||
| 351 | #define INTC_CONTROL INTC_REG32(0x048) | ||
| 352 | #define INTC_ILR11 INTC_REG32(0x12C) | ||
| 353 | #define INTC_ILR32 INTC_REG32(0x180) | ||
| 354 | #define INTC_ILR37 INTC_REG32(0x194) | ||
| 355 | #define INTC_SYSCONFIG INTC_REG32(0x010) | ||
| 356 | |||
| 357 | /* RAM FIREWALL */ | ||
| 358 | #define RAMFW_BASE (0x68005000) | ||
| 359 | #define RAMFW_REG32(offset) __REG32(RAMFW_BASE + (offset)) | ||
| 360 | |||
| 361 | #define RAMFW_REQINFOPERM0 RAMFW_REG32(0x048) | ||
| 362 | #define RAMFW_READPERM0 RAMFW_REG32(0x050) | ||
| 363 | #define RAMFW_WRITEPERM0 RAMFW_REG32(0x058) | ||
| 364 | |||
| 365 | /* GPMC CS1 FPGA ON USER INTERFACE MODULE */ | ||
| 366 | //#define DEBUG_BOARD_LED_REGISTER 0x04000014 | ||
| 367 | |||
| 368 | /* GPMC CS0 */ | ||
| 369 | #define GPMC_CONFIG1_0 GPMC_REG32(0x060) | ||
| 370 | #define GPMC_CONFIG2_0 GPMC_REG32(0x064) | ||
| 371 | #define GPMC_CONFIG3_0 GPMC_REG32(0x068) | ||
| 372 | #define GPMC_CONFIG4_0 GPMC_REG32(0x06C) | ||
| 373 | #define GPMC_CONFIG5_0 GPMC_REG32(0x070) | ||
| 374 | #define GPMC_CONFIG6_0 GPMC_REG32(0x074) | ||
| 375 | #define GPMC_CONFIG7_0 GPMC_REG32(0x078) | ||
| 376 | |||
| 377 | /* GPMC CS1 */ | ||
| 378 | #define GPMC_CONFIG1_1 GPMC_REG32(0x090) | ||
| 379 | #define GPMC_CONFIG2_1 GPMC_REG32(0x094) | ||
| 380 | #define GPMC_CONFIG3_1 GPMC_REG32(0x098) | ||
| 381 | #define GPMC_CONFIG4_1 GPMC_REG32(0x09C) | ||
| 382 | #define GPMC_CONFIG5_1 GPMC_REG32(0x0a0) | ||
| 383 | #define GPMC_CONFIG6_1 GPMC_REG32(0x0a4) | ||
| 384 | #define GPMC_CONFIG7_1 GPMC_REG32(0x0a8) | ||
| 385 | |||
| 386 | /* DSS */ | ||
| 387 | #define DSS_CONTROL DISP_REG32(0x040) | ||
| 388 | #define DISPC_CONTROL DISP_REG32(0x440) | ||
| 389 | #define DISPC_SYSSTATUS DISP_REG32(0x414) | ||
| 390 | #define DISPC_IRQSTATUS DISP_REG32(0x418) | ||
| 391 | #define DISPC_IRQENABLE DISP_REG32(0x41C) | ||
| 392 | #define DISPC_CONFIG DISP_REG32(0x444) | ||
| 393 | #define DISPC_DEFAULT_COLOR0 DISP_REG32(0x44C) | ||
| 394 | #define DISPC_DEFAULT_COLOR1 DISP_REG32(0x450) | ||
| 395 | #define DISPC_TRANS_COLOR0 DISP_REG32(0x454) | ||
| 396 | #define DISPC_TRANS_COLOR1 DISP_REG32(0x458) | ||
| 397 | #define DISPC_LINE_NUMBER DISP_REG32(0x460) | ||
| 398 | #define DISPC_TIMING_H DISP_REG32(0x464) | ||
| 399 | #define DISPC_TIMING_V DISP_REG32(0x468) | ||
| 400 | #define DISPC_POL_FREQ DISP_REG32(0x46C) | ||
| 401 | #define DISPC_DIVISOR DISP_REG32(0x470) | ||
| 402 | #define DISPC_SIZE_DIG DISP_REG32(0x478) | ||
| 403 | #define DISPC_SIZE_LCD DISP_REG32(0x47C) | ||
| 404 | #define DISPC_GFX_BA0 DISP_REG32(0x480) | ||
| 405 | #define DISPC_GFX_BA1 DISP_REG32(0x484) | ||
| 406 | #define DISPC_GFX_POSITION DISP_REG32(0x488) | ||
| 407 | #define DISPC_GFX_SIZE DISP_REG32(0x48C) | ||
| 408 | #define DISPC_GFX_ATTRIBUTES DISP_REG32(0x4A0) | ||
| 409 | #define DISPC_GFX_FIFO_THRESHOLD DISP_REG32(0x4A4) | ||
| 410 | #define DISPC_GFX_ROW_INC DISP_REG32(0x4AC) | ||
| 411 | #define DISPC_GFX_PIXEL_INC DISP_REG32(0x4B0) | ||
| 412 | #define DISPC_GFX_WINDOW_SKIP DISP_REG32(0x4B4) | ||
| 413 | #define DISPC_GFX_TABLE_BA DISP_REG32(0x4B8) | ||
| 414 | #define DISPC_DATA_CYCLE1 DISP_REG32(0x5D4) | ||
| 415 | #define DISPC_DATA_CYCLE2 DISP_REG32(0x5D8) | ||
| 416 | #define DISPC_DATA_CYCLE3 DISP_REG32(0x5DC) | ||
| 417 | |||
| 418 | /* Wake up define for board */ | ||
| 419 | #define GPIO97 (1 << 1) | ||
| 420 | #define GPIO88 (1 << 24) | ||
| 421 | |||
| 422 | #endif /* __ASSEMBLER__ */ | ||
| 423 | 27 | ||
| 424 | #endif | 28 | #endif |
| 425 | 29 | ||
diff --git a/include/asm-arm/arch-omap/system.h b/include/asm-arm/arch-omap/system.h index 6724a81bd10b..67970d1a2020 100644 --- a/include/asm-arm/arch-omap/system.h +++ b/include/asm-arm/arch-omap/system.h | |||
| @@ -9,12 +9,13 @@ | |||
| 9 | 9 | ||
| 10 | #include <asm/mach-types.h> | 10 | #include <asm/mach-types.h> |
| 11 | #include <asm/hardware.h> | 11 | #include <asm/hardware.h> |
| 12 | #include <asm/arch/prcm.h> | ||
| 13 | 12 | ||
| 14 | #ifndef CONFIG_MACH_VOICEBLUE | 13 | #ifndef CONFIG_MACH_VOICEBLUE |
| 15 | #define voiceblue_reset() do {} while (0) | 14 | #define voiceblue_reset() do {} while (0) |
| 16 | #endif | 15 | #endif |
| 17 | 16 | ||
| 17 | extern void omap_prcm_arch_reset(char mode); | ||
| 18 | |||
| 18 | static inline void arch_idle(void) | 19 | static inline void arch_idle(void) |
| 19 | { | 20 | { |
| 20 | cpu_do_idle(); | 21 | cpu_do_idle(); |
| @@ -38,24 +39,12 @@ static inline void omap1_arch_reset(char mode) | |||
| 38 | omap_writew(1, ARM_RSTCT1); | 39 | omap_writew(1, ARM_RSTCT1); |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | static inline void omap2_arch_reset(char mode) | ||
| 42 | { | ||
| 43 | u32 rate; | ||
| 44 | struct clk *vclk, *sclk; | ||
| 45 | |||
| 46 | vclk = clk_get(NULL, "virt_prcm_set"); | ||
| 47 | sclk = clk_get(NULL, "sys_ck"); | ||
| 48 | rate = clk_get_rate(sclk); | ||
| 49 | clk_set_rate(vclk, rate); /* go to bypass for OMAP limitation */ | ||
| 50 | RM_RSTCTRL_WKUP |= 2; | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline void arch_reset(char mode) | 42 | static inline void arch_reset(char mode) |
| 54 | { | 43 | { |
| 55 | if (!cpu_is_omap24xx()) | 44 | if (!cpu_is_omap24xx()) |
| 56 | omap1_arch_reset(mode); | 45 | omap1_arch_reset(mode); |
| 57 | else | 46 | else |
| 58 | omap2_arch_reset(mode); | 47 | omap_prcm_arch_reset(mode); |
| 59 | } | 48 | } |
| 60 | 49 | ||
| 61 | #endif | 50 | #endif |
