diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-11-24 20:59:46 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2012-02-23 08:57:57 -0500 |
commit | b55149529d265718a989b67468c4f03de0d3af7a (patch) | |
tree | cccba7e40bbca7b0ded59152162bb64b343dc337 /arch/arm | |
parent | 940192e3c651eb6b97b42cb4c28e9e8471675cd2 (diff) |
ARM: at91/PMC: make register base soc independent
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Reviewed-by: Ryan Mallon <rmallon@gmail.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/at91rm9200.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/clock.c | 75 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91_pmc.h | 56 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91rm9200.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9260.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9261.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9263.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9g45.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9rl.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9x5.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/hardware.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm_slowclock.S | 38 |
13 files changed, 101 insertions, 92 deletions
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 7923197cb506..0df1045311e4 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -295,7 +295,7 @@ static void at91rm9200_idle(void) | |||
295 | * Disable the processor clock. The processor will be automatically | 295 | * Disable the processor clock. The processor will be automatically |
296 | * re-enabled by an interrupt or by a reset. | 296 | * re-enabled by an interrupt or by a reset. |
297 | */ | 297 | */ |
298 | at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK); | 298 | at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); |
299 | } | 299 | } |
300 | 300 | ||
301 | static void at91rm9200_restart(char mode, const char *cmd) | 301 | static void at91rm9200_restart(char mode, const char *cmd) |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 9ab862740161..be51ca7f694d 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "clock.h" | 33 | #include "clock.h" |
34 | #include "generic.h" | 34 | #include "generic.h" |
35 | 35 | ||
36 | void __iomem *at91_pmc_base; | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * There's a lot more which can be done with clocks, including cpufreq | 39 | * There's a lot more which can be done with clocks, including cpufreq |
@@ -125,11 +126,11 @@ static void pllb_mode(struct clk *clk, int is_on) | |||
125 | value = 0; | 126 | value = 0; |
126 | 127 | ||
127 | // REVISIT: Add work-around for AT91RM9200 Errata #26 ? | 128 | // REVISIT: Add work-around for AT91RM9200 Errata #26 ? |
128 | at91_sys_write(AT91_CKGR_PLLBR, value); | 129 | at91_pmc_write(AT91_CKGR_PLLBR, value); |
129 | 130 | ||
130 | do { | 131 | do { |
131 | cpu_relax(); | 132 | cpu_relax(); |
132 | } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on); | 133 | } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on); |
133 | } | 134 | } |
134 | 135 | ||
135 | static struct clk pllb = { | 136 | static struct clk pllb = { |
@@ -144,24 +145,24 @@ static struct clk pllb = { | |||
144 | static void pmc_sys_mode(struct clk *clk, int is_on) | 145 | static void pmc_sys_mode(struct clk *clk, int is_on) |
145 | { | 146 | { |
146 | if (is_on) | 147 | if (is_on) |
147 | at91_sys_write(AT91_PMC_SCER, clk->pmc_mask); | 148 | at91_pmc_write(AT91_PMC_SCER, clk->pmc_mask); |
148 | else | 149 | else |
149 | at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask); | 150 | at91_pmc_write(AT91_PMC_SCDR, clk->pmc_mask); |
150 | } | 151 | } |
151 | 152 | ||
152 | static void pmc_uckr_mode(struct clk *clk, int is_on) | 153 | static void pmc_uckr_mode(struct clk *clk, int is_on) |
153 | { | 154 | { |
154 | unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR); | 155 | unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR); |
155 | 156 | ||
156 | if (is_on) { | 157 | if (is_on) { |
157 | is_on = AT91_PMC_LOCKU; | 158 | is_on = AT91_PMC_LOCKU; |
158 | at91_sys_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask); | 159 | at91_pmc_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask); |
159 | } else | 160 | } else |
160 | at91_sys_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask)); | 161 | at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask)); |
161 | 162 | ||
162 | do { | 163 | do { |
163 | cpu_relax(); | 164 | cpu_relax(); |
164 | } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on); | 165 | } while ((at91_pmc_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on); |
165 | } | 166 | } |
166 | 167 | ||
167 | /* USB function clocks (PLLB must be 48 MHz) */ | 168 | /* USB function clocks (PLLB must be 48 MHz) */ |
@@ -197,9 +198,9 @@ struct clk mck = { | |||
197 | static void pmc_periph_mode(struct clk *clk, int is_on) | 198 | static void pmc_periph_mode(struct clk *clk, int is_on) |
198 | { | 199 | { |
199 | if (is_on) | 200 | if (is_on) |
200 | at91_sys_write(AT91_PMC_PCER, clk->pmc_mask); | 201 | at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask); |
201 | else | 202 | else |
202 | at91_sys_write(AT91_PMC_PCDR, clk->pmc_mask); | 203 | at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask); |
203 | } | 204 | } |
204 | 205 | ||
205 | static struct clk __init *at91_css_to_clk(unsigned long css) | 206 | static struct clk __init *at91_css_to_clk(unsigned long css) |
@@ -359,10 +360,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
359 | if (actual && actual <= rate) { | 360 | if (actual && actual <= rate) { |
360 | u32 pckr; | 361 | u32 pckr; |
361 | 362 | ||
362 | pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); | 363 | pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id)); |
363 | pckr &= css_mask; /* keep clock selection */ | 364 | pckr &= css_mask; /* keep clock selection */ |
364 | pckr |= prescale << prescale_offset; | 365 | pckr |= prescale << prescale_offset; |
365 | at91_sys_write(AT91_PMC_PCKR(clk->id), pckr); | 366 | at91_pmc_write(AT91_PMC_PCKR(clk->id), pckr); |
366 | clk->rate_hz = actual; | 367 | clk->rate_hz = actual; |
367 | break; | 368 | break; |
368 | } | 369 | } |
@@ -396,7 +397,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
396 | 397 | ||
397 | clk->rate_hz = parent->rate_hz; | 398 | clk->rate_hz = parent->rate_hz; |
398 | clk->parent = parent; | 399 | clk->parent = parent; |
399 | at91_sys_write(AT91_PMC_PCKR(clk->id), parent->id); | 400 | at91_pmc_write(AT91_PMC_PCKR(clk->id), parent->id); |
400 | 401 | ||
401 | spin_unlock_irqrestore(&clk_lock, flags); | 402 | spin_unlock_irqrestore(&clk_lock, flags); |
402 | return 0; | 403 | return 0; |
@@ -415,7 +416,7 @@ static void __init init_programmable_clock(struct clk *clk) | |||
415 | else | 416 | else |
416 | css_mask = AT91_PMC_CSS; | 417 | css_mask = AT91_PMC_CSS; |
417 | 418 | ||
418 | pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); | 419 | pckr = at91_pmc_read(AT91_PMC_PCKR(clk->id)); |
419 | parent = at91_css_to_clk(pckr & css_mask); | 420 | parent = at91_css_to_clk(pckr & css_mask); |
420 | clk->parent = parent; | 421 | clk->parent = parent; |
421 | clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); | 422 | clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); |
@@ -432,23 +433,23 @@ static int at91_clk_show(struct seq_file *s, void *unused) | |||
432 | u32 scsr, pcsr, uckr = 0, sr; | 433 | u32 scsr, pcsr, uckr = 0, sr; |
433 | struct clk *clk; | 434 | struct clk *clk; |
434 | 435 | ||
435 | scsr = at91_sys_read(AT91_PMC_SCSR); | 436 | scsr = at91_pmc_read(AT91_PMC_SCSR); |
436 | pcsr = at91_sys_read(AT91_PMC_PCSR); | 437 | pcsr = at91_pmc_read(AT91_PMC_PCSR); |
437 | sr = at91_sys_read(AT91_PMC_SR); | 438 | sr = at91_pmc_read(AT91_PMC_SR); |
438 | seq_printf(s, "SCSR = %8x\n", scsr); | 439 | seq_printf(s, "SCSR = %8x\n", scsr); |
439 | seq_printf(s, "PCSR = %8x\n", pcsr); | 440 | seq_printf(s, "PCSR = %8x\n", pcsr); |
440 | seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); | 441 | seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR)); |
441 | seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); | 442 | seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR)); |
442 | seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); | 443 | seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR)); |
443 | if (cpu_has_pllb()) | 444 | if (cpu_has_pllb()) |
444 | seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); | 445 | seq_printf(s, "PLLB = %8x\n", at91_pmc_read(AT91_CKGR_PLLBR)); |
445 | if (cpu_has_utmi()) { | 446 | if (cpu_has_utmi()) { |
446 | uckr = at91_sys_read(AT91_CKGR_UCKR); | 447 | uckr = at91_pmc_read(AT91_CKGR_UCKR); |
447 | seq_printf(s, "UCKR = %8x\n", uckr); | 448 | seq_printf(s, "UCKR = %8x\n", uckr); |
448 | } | 449 | } |
449 | seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); | 450 | seq_printf(s, "MCKR = %8x\n", at91_pmc_read(AT91_PMC_MCKR)); |
450 | if (cpu_has_upll()) | 451 | if (cpu_has_upll()) |
451 | seq_printf(s, "USB = %8x\n", at91_sys_read(AT91_PMC_USB)); | 452 | seq_printf(s, "USB = %8x\n", at91_pmc_read(AT91_PMC_USB)); |
452 | seq_printf(s, "SR = %8x\n", sr); | 453 | seq_printf(s, "SR = %8x\n", sr); |
453 | 454 | ||
454 | seq_printf(s, "\n"); | 455 | seq_printf(s, "\n"); |
@@ -637,14 +638,14 @@ static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock) | |||
637 | if (cpu_is_at91rm9200()) { | 638 | if (cpu_is_at91rm9200()) { |
638 | uhpck.pmc_mask = AT91RM9200_PMC_UHP; | 639 | uhpck.pmc_mask = AT91RM9200_PMC_UHP; |
639 | udpck.pmc_mask = AT91RM9200_PMC_UDP; | 640 | udpck.pmc_mask = AT91RM9200_PMC_UDP; |
640 | at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); | 641 | at91_pmc_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); |
641 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || | 642 | } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || |
642 | cpu_is_at91sam9263() || cpu_is_at91sam9g20() || | 643 | cpu_is_at91sam9263() || cpu_is_at91sam9g20() || |
643 | cpu_is_at91sam9g10()) { | 644 | cpu_is_at91sam9g10()) { |
644 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 645 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
645 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; | 646 | udpck.pmc_mask = AT91SAM926x_PMC_UDP; |
646 | } | 647 | } |
647 | at91_sys_write(AT91_CKGR_PLLBR, 0); | 648 | at91_pmc_write(AT91_CKGR_PLLBR, 0); |
648 | 649 | ||
649 | udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | 650 | udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); |
650 | uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); | 651 | uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); |
@@ -661,13 +662,13 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock) | |||
661 | /* Setup divider by 10 to reach 48 MHz */ | 662 | /* Setup divider by 10 to reach 48 MHz */ |
662 | usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV; | 663 | usbr |= ((10 - 1) << 8) & AT91_PMC_OHCIUSBDIV; |
663 | 664 | ||
664 | at91_sys_write(AT91_PMC_USB, usbr); | 665 | at91_pmc_write(AT91_PMC_USB, usbr); |
665 | 666 | ||
666 | /* Now set uhpck values */ | 667 | /* Now set uhpck values */ |
667 | uhpck.parent = &utmi_clk; | 668 | uhpck.parent = &utmi_clk; |
668 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 669 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
669 | uhpck.rate_hz = utmi_clk.rate_hz; | 670 | uhpck.rate_hz = utmi_clk.rate_hz; |
670 | uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); | 671 | uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); |
671 | } | 672 | } |
672 | 673 | ||
673 | int __init at91_clock_init(unsigned long main_clock) | 674 | int __init at91_clock_init(unsigned long main_clock) |
@@ -676,6 +677,10 @@ int __init at91_clock_init(unsigned long main_clock) | |||
676 | int i; | 677 | int i; |
677 | int pll_overclock = false; | 678 | int pll_overclock = false; |
678 | 679 | ||
680 | at91_pmc_base = ioremap(AT91_PMC, 256); | ||
681 | if (!at91_pmc_base) | ||
682 | panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC); | ||
683 | |||
679 | /* | 684 | /* |
680 | * When the bootloader initialized the main oscillator correctly, | 685 | * When the bootloader initialized the main oscillator correctly, |
681 | * there's no problem using the cycle counter. But if it didn't, | 686 | * there's no problem using the cycle counter. But if it didn't, |
@@ -684,14 +689,14 @@ int __init at91_clock_init(unsigned long main_clock) | |||
684 | */ | 689 | */ |
685 | if (!main_clock) { | 690 | if (!main_clock) { |
686 | do { | 691 | do { |
687 | tmp = at91_sys_read(AT91_CKGR_MCFR); | 692 | tmp = at91_pmc_read(AT91_CKGR_MCFR); |
688 | } while (!(tmp & AT91_PMC_MAINRDY)); | 693 | } while (!(tmp & AT91_PMC_MAINRDY)); |
689 | main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16); | 694 | main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16); |
690 | } | 695 | } |
691 | main_clk.rate_hz = main_clock; | 696 | main_clk.rate_hz = main_clock; |
692 | 697 | ||
693 | /* report if PLLA is more than mildly overclocked */ | 698 | /* report if PLLA is more than mildly overclocked */ |
694 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); | 699 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR)); |
695 | if (cpu_has_300M_plla()) { | 700 | if (cpu_has_300M_plla()) { |
696 | if (plla.rate_hz > 300000000) | 701 | if (plla.rate_hz > 300000000) |
697 | pll_overclock = true; | 702 | pll_overclock = true; |
@@ -706,7 +711,7 @@ int __init at91_clock_init(unsigned long main_clock) | |||
706 | pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); | 711 | pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); |
707 | 712 | ||
708 | if (cpu_has_plladiv2()) { | 713 | if (cpu_has_plladiv2()) { |
709 | mckr = at91_sys_read(AT91_PMC_MCKR); | 714 | mckr = at91_pmc_read(AT91_PMC_MCKR); |
710 | plla.rate_hz /= (1 << ((mckr & AT91_PMC_PLLADIV2) >> 12)); /* plla divisor by 2 */ | 715 | plla.rate_hz /= (1 << ((mckr & AT91_PMC_PLLADIV2) >> 12)); /* plla divisor by 2 */ |
711 | } | 716 | } |
712 | 717 | ||
@@ -746,7 +751,7 @@ int __init at91_clock_init(unsigned long main_clock) | |||
746 | * MCK and CPU derive from one of those primary clocks. | 751 | * MCK and CPU derive from one of those primary clocks. |
747 | * For now, assume this parentage won't change. | 752 | * For now, assume this parentage won't change. |
748 | */ | 753 | */ |
749 | mckr = at91_sys_read(AT91_PMC_MCKR); | 754 | mckr = at91_pmc_read(AT91_PMC_MCKR); |
750 | mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); | 755 | mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); |
751 | freq = mck.parent->rate_hz; | 756 | freq = mck.parent->rate_hz; |
752 | freq /= pmc_prescaler_divider(mckr); /* prescale */ | 757 | freq /= pmc_prescaler_divider(mckr); /* prescale */ |
@@ -819,8 +824,8 @@ static int __init at91_clock_reset(void) | |||
819 | pr_debug("Clocks: disable unused %s\n", clk->name); | 824 | pr_debug("Clocks: disable unused %s\n", clk->name); |
820 | } | 825 | } |
821 | 826 | ||
822 | at91_sys_write(AT91_PMC_PCDR, pcdr); | 827 | at91_pmc_write(AT91_PMC_PCDR, pcdr); |
823 | at91_sys_write(AT91_PMC_SCDR, scdr); | 828 | at91_pmc_write(AT91_PMC_SCDR, scdr); |
824 | 829 | ||
825 | return 0; | 830 | return 0; |
826 | } | 831 | } |
@@ -828,6 +833,6 @@ late_initcall(at91_clock_reset); | |||
828 | 833 | ||
829 | void at91sam9_idle(void) | 834 | void at91sam9_idle(void) |
830 | { | 835 | { |
831 | at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK); | 836 | at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); |
832 | cpu_do_idle(); | 837 | cpu_do_idle(); |
833 | } | 838 | } |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index f9fdbbe0c53a..36604782a78f 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
@@ -16,10 +16,22 @@ | |||
16 | #ifndef AT91_PMC_H | 16 | #ifndef AT91_PMC_H |
17 | #define AT91_PMC_H | 17 | #define AT91_PMC_H |
18 | 18 | ||
19 | #define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */ | 19 | #ifndef __ASSEMBLY__ |
20 | #define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */ | 20 | extern void __iomem *at91_pmc_base; |
21 | 21 | ||
22 | #define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */ | 22 | #define at91_pmc_read(field) \ |
23 | __raw_readl(at91_pmc_base + field) | ||
24 | |||
25 | #define at91_pmc_write(field, value) \ | ||
26 | __raw_writel(value, at91_pmc_base + field) | ||
27 | #else | ||
28 | .extern at91_aic_base | ||
29 | #endif | ||
30 | |||
31 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ | ||
32 | #define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */ | ||
33 | |||
34 | #define AT91_PMC_SCSR 0x08 /* System Clock Status Register */ | ||
23 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ | 35 | #define AT91_PMC_PCK (1 << 0) /* Processor Clock */ |
24 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ | 36 | #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */ |
25 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ | 37 | #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */ |
@@ -34,17 +46,17 @@ | |||
34 | #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */ | 46 | #define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */ |
35 | #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */ | 47 | #define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */ |
36 | 48 | ||
37 | #define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */ | 49 | #define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */ |
38 | #define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */ | 50 | #define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */ |
39 | #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */ | 51 | #define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */ |
40 | 52 | ||
41 | #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [some SAM9] */ | 53 | #define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */ |
42 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ | 54 | #define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */ |
43 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ | 55 | #define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */ |
44 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ | 56 | #define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */ |
45 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ | 57 | #define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */ |
46 | 58 | ||
47 | #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */ | 59 | #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */ |
48 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ | 60 | #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ |
49 | #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */ | 61 | #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */ |
50 | #define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */ | 62 | #define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */ |
@@ -53,12 +65,12 @@ | |||
53 | #define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */ | 65 | #define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */ |
54 | #define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */ | 66 | #define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */ |
55 | 67 | ||
56 | #define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */ | 68 | #define AT91_CKGR_MCFR 0x24 /* Main Clock Frequency Register */ |
57 | #define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */ | 69 | #define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */ |
58 | #define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */ | 70 | #define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */ |
59 | 71 | ||
60 | #define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */ | 72 | #define AT91_CKGR_PLLAR 0x28 /* PLL A Register */ |
61 | #define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */ | 73 | #define AT91_CKGR_PLLBR 0x2c /* PLL B Register */ |
62 | #define AT91_PMC_DIV (0xff << 0) /* Divider */ | 74 | #define AT91_PMC_DIV (0xff << 0) /* Divider */ |
63 | #define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ | 75 | #define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ |
64 | #define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ | 76 | #define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ |
@@ -69,7 +81,7 @@ | |||
69 | #define AT91_PMC_USBDIV_4 (2 << 28) | 81 | #define AT91_PMC_USBDIV_4 (2 << 28) |
70 | #define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */ | 82 | #define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */ |
71 | 83 | ||
72 | #define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */ | 84 | #define AT91_PMC_MCKR 0x30 /* Master Clock Register */ |
73 | #define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */ | 85 | #define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */ |
74 | #define AT91_PMC_CSS_SLOW (0 << 0) | 86 | #define AT91_PMC_CSS_SLOW (0 << 0) |
75 | #define AT91_PMC_CSS_MAIN (1 << 0) | 87 | #define AT91_PMC_CSS_MAIN (1 << 0) |
@@ -111,27 +123,27 @@ | |||
111 | #define AT91_PMC_PLLADIV2_OFF (0 << 12) | 123 | #define AT91_PMC_PLLADIV2_OFF (0 << 12) |
112 | #define AT91_PMC_PLLADIV2_ON (1 << 12) | 124 | #define AT91_PMC_PLLADIV2_ON (1 << 12) |
113 | 125 | ||
114 | #define AT91_PMC_USB (AT91_PMC + 0x38) /* USB Clock Register [some SAM9 only] */ | 126 | #define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */ |
115 | #define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ | 127 | #define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ |
116 | #define AT91_PMC_USBS_PLLA (0 << 0) | 128 | #define AT91_PMC_USBS_PLLA (0 << 0) |
117 | #define AT91_PMC_USBS_UPLL (1 << 0) | 129 | #define AT91_PMC_USBS_UPLL (1 << 0) |
118 | #define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */ | 130 | #define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */ |
119 | 131 | ||
120 | #define AT91_PMC_SMD (AT91_PMC + 0x3c) /* Soft Modem Clock Register [some SAM9 only] */ | 132 | #define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */ |
121 | #define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */ | 133 | #define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */ |
122 | #define AT91_PMC_SMD_DIV (0x1f << 8) /* SMD input clock divider */ | 134 | #define AT91_PMC_SMD_DIV (0x1f << 8) /* SMD input clock divider */ |
123 | #define AT91_PMC_SMDDIV(n) (((n) << 8) & AT91_PMC_SMD_DIV) | 135 | #define AT91_PMC_SMDDIV(n) (((n) << 8) & AT91_PMC_SMD_DIV) |
124 | 136 | ||
125 | #define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */ | 137 | #define AT91_PMC_PCKR(n) (0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */ |
126 | #define AT91_PMC_ALT_PCKR_CSS (0x7 << 0) /* Programmable Clock Source Selection [alternate length] */ | 138 | #define AT91_PMC_ALT_PCKR_CSS (0x7 << 0) /* Programmable Clock Source Selection [alternate length] */ |
127 | #define AT91_PMC_CSS_MASTER (4 << 0) /* [some SAM9 only] */ | 139 | #define AT91_PMC_CSS_MASTER (4 << 0) /* [some SAM9 only] */ |
128 | #define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */ | 140 | #define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */ |
129 | #define AT91_PMC_CSSMCK_CSS (0 << 8) | 141 | #define AT91_PMC_CSSMCK_CSS (0 << 8) |
130 | #define AT91_PMC_CSSMCK_MCK (1 << 8) | 142 | #define AT91_PMC_CSSMCK_MCK (1 << 8) |
131 | 143 | ||
132 | #define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */ | 144 | #define AT91_PMC_IER 0x60 /* Interrupt Enable Register */ |
133 | #define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */ | 145 | #define AT91_PMC_IDR 0x64 /* Interrupt Disable Register */ |
134 | #define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */ | 146 | #define AT91_PMC_SR 0x68 /* Status Register */ |
135 | #define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */ | 147 | #define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */ |
136 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ | 148 | #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */ |
137 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ | 149 | #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ |
@@ -144,18 +156,18 @@ | |||
144 | #define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */ | 156 | #define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */ |
145 | #define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */ | 157 | #define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */ |
146 | #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ | 158 | #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ |
147 | #define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */ | 159 | #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ |
148 | 160 | ||
149 | #define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Write Protect Mode Register [some SAM9] */ | 161 | #define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */ |
150 | #define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */ | 162 | #define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */ |
151 | #define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */ | 163 | #define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */ |
152 | #define AT91_PMC_PROTKEY (0x504d43 << 8) /* Activation Code */ | 164 | #define AT91_PMC_PROTKEY (0x504d43 << 8) /* Activation Code */ |
153 | 165 | ||
154 | #define AT91_PMC_WPSR (AT91_PMC + 0xe8) /* Write Protect Status Register [some SAM9] */ | 166 | #define AT91_PMC_WPSR 0xe8 /* Write Protect Status Register [some SAM9] */ |
155 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ | 167 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ |
156 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ | 168 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ |
157 | 169 | ||
158 | #define AT91_PMC_PCR (AT91_PMC + 0x10c) /* Peripheral Control Register [some SAM9] */ | 170 | #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9] */ |
159 | #define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ | 171 | #define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ |
160 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command */ | 172 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command */ |
161 | #define AT91_PMC_PCR_DIV (0x3 << 16) /* Divisor Value */ | 173 | #define AT91_PMC_PCR_DIV (0x3 << 16) /* Divisor Value */ |
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h index 32d57be47986..603e6aac2a4f 100644 --- a/arch/arm/mach-at91/include/mach/at91rm9200.h +++ b/arch/arm/mach-at91/include/mach/at91rm9200.h | |||
@@ -77,10 +77,8 @@ | |||
77 | 77 | ||
78 | 78 | ||
79 | /* | 79 | /* |
80 | * System Peripherals (offset from AT91_BASE_SYS) | 80 | * System Peripherals |
81 | */ | 81 | */ |
82 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */ | ||
83 | |||
84 | #define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ | 82 | #define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ |
85 | #define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */ | 83 | #define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */ |
86 | #define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ | 84 | #define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h index c5b6b3b71060..1524e87c0043 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9260.h +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h | |||
@@ -80,7 +80,6 @@ | |||
80 | /* | 80 | /* |
81 | * System Peripherals (offset from AT91_BASE_SYS) | 81 | * System Peripherals (offset from AT91_BASE_SYS) |
82 | */ | 82 | */ |
83 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
84 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 83 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
85 | 84 | ||
86 | #define AT91SAM9260_BASE_ECC 0xffffe800 | 85 | #define AT91SAM9260_BASE_ECC 0xffffe800 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h index a269cef51aec..a6a3c1d4bc7f 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9261.h +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h | |||
@@ -65,7 +65,6 @@ | |||
65 | /* | 65 | /* |
66 | * System Peripherals (offset from AT91_BASE_SYS) | 66 | * System Peripherals (offset from AT91_BASE_SYS) |
67 | */ | 67 | */ |
68 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
69 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 68 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
70 | 69 | ||
71 | #define AT91SAM9261_BASE_SMC 0xffffec00 | 70 | #define AT91SAM9261_BASE_SMC 0xffffec00 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h index bccba0b679c2..dda083d1a66b 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9263.h +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h | |||
@@ -74,7 +74,6 @@ | |||
74 | /* | 74 | /* |
75 | * System Peripherals (offset from AT91_BASE_SYS) | 75 | * System Peripherals (offset from AT91_BASE_SYS) |
76 | */ | 76 | */ |
77 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
78 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 77 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
79 | 78 | ||
80 | #define AT91SAM9263_BASE_ECC0 0xffffe000 | 79 | #define AT91SAM9263_BASE_ECC0 0xffffe000 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h index dfc4570fffe2..a824e15bf00d 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h | |||
@@ -86,7 +86,6 @@ | |||
86 | /* | 86 | /* |
87 | * System Peripherals (offset from AT91_BASE_SYS) | 87 | * System Peripherals (offset from AT91_BASE_SYS) |
88 | */ | 88 | */ |
89 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
90 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 89 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
91 | 90 | ||
92 | #define AT91SAM9G45_BASE_ECC 0xffffe200 | 91 | #define AT91SAM9G45_BASE_ECC 0xffffe200 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h index de960dc1da05..2d7176ac9002 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h | |||
@@ -69,7 +69,6 @@ | |||
69 | /* | 69 | /* |
70 | * System Peripherals (offset from AT91_BASE_SYS) | 70 | * System Peripherals (offset from AT91_BASE_SYS) |
71 | */ | 71 | */ |
72 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
73 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) | 72 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) |
74 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 73 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
75 | 74 | ||
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h index 96f25f556abf..a297a77d88e2 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9x5.h +++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h | |||
@@ -55,10 +55,9 @@ | |||
55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 | 55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * System Peripherals (offset from AT91_BASE_SYS) | 58 | * System Peripherals |
59 | */ | 59 | */ |
60 | #define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800 | 60 | #define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800 |
61 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | ||
62 | 61 | ||
63 | /* | 62 | /* |
64 | * Base addresses for early serial code (uncompress.h) | 63 | * Base addresses for early serial code (uncompress.h) |
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h index fd7dce4f7378..e9e29a6c3868 100644 --- a/arch/arm/mach-at91/include/mach/hardware.h +++ b/arch/arm/mach-at91/include/mach/hardware.h | |||
@@ -59,9 +59,10 @@ | |||
59 | 59 | ||
60 | /* | 60 | /* |
61 | * On all at91 have the Advanced Interrupt Controller starts at address | 61 | * On all at91 have the Advanced Interrupt Controller starts at address |
62 | * 0xfffff000 | 62 | * 0xfffff000 and the Power Management Controller starts at 0xfffffc00 |
63 | */ | 63 | */ |
64 | #define AT91_AIC 0xfffff000 | 64 | #define AT91_AIC 0xfffff000 |
65 | #define AT91_PMC 0xfffffc00 | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * Peripheral identifiers/interrupts. | 68 | * Peripheral identifiers/interrupts. |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 2793591c73c0..6c9d5e69ac28 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -136,7 +136,7 @@ static int at91_pm_verify_clocks(void) | |||
136 | unsigned long scsr; | 136 | unsigned long scsr; |
137 | int i; | 137 | int i; |
138 | 138 | ||
139 | scsr = at91_sys_read(AT91_PMC_SCSR); | 139 | scsr = at91_pmc_read(AT91_PMC_SCSR); |
140 | 140 | ||
141 | /* USB must not be using PLLB */ | 141 | /* USB must not be using PLLB */ |
142 | if (cpu_is_at91rm9200()) { | 142 | if (cpu_is_at91rm9200()) { |
@@ -160,7 +160,7 @@ static int at91_pm_verify_clocks(void) | |||
160 | if ((scsr & (AT91_PMC_PCK0 << i)) == 0) | 160 | if ((scsr & (AT91_PMC_PCK0 << i)) == 0) |
161 | continue; | 161 | continue; |
162 | 162 | ||
163 | css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; | 163 | css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; |
164 | if (css != AT91_PMC_CSS_SLOW) { | 164 | if (css != AT91_PMC_CSS_SLOW) { |
165 | pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); | 165 | pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); |
166 | return 0; | 166 | return 0; |
@@ -197,7 +197,6 @@ extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0, | |||
197 | extern u32 at91_slow_clock_sz; | 197 | extern u32 at91_slow_clock_sz; |
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | static void __iomem *at91_pmc_base = (void __iomem*)(AT91_VA_BASE_SYS + AT91_PMC); | ||
201 | void __iomem *at91_ramc_base[2]; | 200 | void __iomem *at91_ramc_base[2]; |
202 | 201 | ||
203 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | 202 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) |
@@ -218,7 +217,7 @@ static int at91_pm_enter(suspend_state_t state) | |||
218 | 217 | ||
219 | pr_debug("AT91: PM - wake mask %08x, pm state %d\n", | 218 | pr_debug("AT91: PM - wake mask %08x, pm state %d\n", |
220 | /* remember all the always-wake irqs */ | 219 | /* remember all the always-wake irqs */ |
221 | (at91_sys_read(AT91_PMC_PCSR) | 220 | (at91_pmc_read(AT91_PMC_PCSR) |
222 | | (1 << AT91_ID_FIQ) | 221 | | (1 << AT91_ID_FIQ) |
223 | | (1 << AT91_ID_SYS) | 222 | | (1 << AT91_ID_SYS) |
224 | | (at91_extern_irq)) | 223 | | (at91_extern_irq)) |
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S index 2c46010953c2..db5452123f17 100644 --- a/arch/arm/mach-at91/pm_slowclock.S +++ b/arch/arm/mach-at91/pm_slowclock.S | |||
@@ -54,7 +54,7 @@ tmp2 .req r5 | |||
54 | 1: sub tmp2, tmp2, #1 | 54 | 1: sub tmp2, tmp2, #1 |
55 | cmp tmp2, #0 | 55 | cmp tmp2, #0 |
56 | beq 2f | 56 | beq 2f |
57 | ldr tmp1, [pmc, #(AT91_PMC_SR - AT91_PMC)] | 57 | ldr tmp1, [pmc, #AT91_PMC_SR] |
58 | tst tmp1, #AT91_PMC_MCKRDY | 58 | tst tmp1, #AT91_PMC_MCKRDY |
59 | beq 1b | 59 | beq 1b |
60 | 2: | 60 | 2: |
@@ -68,7 +68,7 @@ tmp2 .req r5 | |||
68 | 1: sub tmp2, tmp2, #1 | 68 | 1: sub tmp2, tmp2, #1 |
69 | cmp tmp2, #0 | 69 | cmp tmp2, #0 |
70 | beq 2f | 70 | beq 2f |
71 | ldr tmp1, [pmc, #(AT91_PMC_SR - AT91_PMC)] | 71 | ldr tmp1, [pmc, #AT91_PMC_SR] |
72 | tst tmp1, #AT91_PMC_MOSCS | 72 | tst tmp1, #AT91_PMC_MOSCS |
73 | beq 1b | 73 | beq 1b |
74 | 2: | 74 | 2: |
@@ -82,7 +82,7 @@ tmp2 .req r5 | |||
82 | 1: sub tmp2, tmp2, #1 | 82 | 1: sub tmp2, tmp2, #1 |
83 | cmp tmp2, #0 | 83 | cmp tmp2, #0 |
84 | beq 2f | 84 | beq 2f |
85 | ldr tmp1, [pmc, #(AT91_PMC_SR - AT91_PMC)] | 85 | ldr tmp1, [pmc, #AT91_PMC_SR] |
86 | tst tmp1, #AT91_PMC_LOCKA | 86 | tst tmp1, #AT91_PMC_LOCKA |
87 | beq 1b | 87 | beq 1b |
88 | 2: | 88 | 2: |
@@ -96,7 +96,7 @@ tmp2 .req r5 | |||
96 | 1: sub tmp2, tmp2, #1 | 96 | 1: sub tmp2, tmp2, #1 |
97 | cmp tmp2, #0 | 97 | cmp tmp2, #0 |
98 | beq 2f | 98 | beq 2f |
99 | ldr tmp1, [pmc, #(AT91_PMC_SR - AT91_PMC)] | 99 | ldr tmp1, [pmc, #AT91_PMC_SR] |
100 | tst tmp1, #AT91_PMC_LOCKB | 100 | tst tmp1, #AT91_PMC_LOCKB |
101 | beq 1b | 101 | beq 1b |
102 | 2: | 102 | 2: |
@@ -176,14 +176,14 @@ sdr_sr_enable: | |||
176 | 176 | ||
177 | sdr_sr_done: | 177 | sdr_sr_done: |
178 | /* Save Master clock setting */ | 178 | /* Save Master clock setting */ |
179 | ldr tmp1, [pmc, #(AT91_PMC_MCKR - AT91_PMC)] | 179 | ldr tmp1, [pmc, #AT91_PMC_MCKR] |
180 | str tmp1, .saved_mckr | 180 | str tmp1, .saved_mckr |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * Set the Master clock source to slow clock | 183 | * Set the Master clock source to slow clock |
184 | */ | 184 | */ |
185 | bic tmp1, tmp1, #AT91_PMC_CSS | 185 | bic tmp1, tmp1, #AT91_PMC_CSS |
186 | str tmp1, [pmc, #(AT91_PMC_MCKR - AT91_PMC)] | 186 | str tmp1, [pmc, #AT91_PMC_MCKR] |
187 | 187 | ||
188 | wait_mckrdy | 188 | wait_mckrdy |
189 | 189 | ||
@@ -194,44 +194,44 @@ sdr_sr_done: | |||
194 | * See AT91RM9200 errata #27 and #28 for details. | 194 | * See AT91RM9200 errata #27 and #28 for details. |
195 | */ | 195 | */ |
196 | mov tmp1, #0 | 196 | mov tmp1, #0 |
197 | str tmp1, [pmc, #(AT91_PMC_MCKR - AT91_PMC)] | 197 | str tmp1, [pmc, #AT91_PMC_MCKR] |
198 | 198 | ||
199 | wait_mckrdy | 199 | wait_mckrdy |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | /* Save PLLA setting and disable it */ | 202 | /* Save PLLA setting and disable it */ |
203 | ldr tmp1, [pmc, #(AT91_CKGR_PLLAR - AT91_PMC)] | 203 | ldr tmp1, [pmc, #AT91_CKGR_PLLAR] |
204 | str tmp1, .saved_pllar | 204 | str tmp1, .saved_pllar |
205 | 205 | ||
206 | mov tmp1, #AT91_PMC_PLLCOUNT | 206 | mov tmp1, #AT91_PMC_PLLCOUNT |
207 | orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */ | 207 | orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */ |
208 | str tmp1, [pmc, #(AT91_CKGR_PLLAR - AT91_PMC)] | 208 | str tmp1, [pmc, #AT91_CKGR_PLLAR] |
209 | 209 | ||
210 | /* Save PLLB setting and disable it */ | 210 | /* Save PLLB setting and disable it */ |
211 | ldr tmp1, [pmc, #(AT91_CKGR_PLLBR - AT91_PMC)] | 211 | ldr tmp1, [pmc, #AT91_CKGR_PLLBR] |
212 | str tmp1, .saved_pllbr | 212 | str tmp1, .saved_pllbr |
213 | 213 | ||
214 | mov tmp1, #AT91_PMC_PLLCOUNT | 214 | mov tmp1, #AT91_PMC_PLLCOUNT |
215 | str tmp1, [pmc, #(AT91_CKGR_PLLBR - AT91_PMC)] | 215 | str tmp1, [pmc, #AT91_CKGR_PLLBR] |
216 | 216 | ||
217 | /* Turn off the main oscillator */ | 217 | /* Turn off the main oscillator */ |
218 | ldr tmp1, [pmc, #(AT91_CKGR_MOR - AT91_PMC)] | 218 | ldr tmp1, [pmc, #AT91_CKGR_MOR] |
219 | bic tmp1, tmp1, #AT91_PMC_MOSCEN | 219 | bic tmp1, tmp1, #AT91_PMC_MOSCEN |
220 | str tmp1, [pmc, #(AT91_CKGR_MOR - AT91_PMC)] | 220 | str tmp1, [pmc, #AT91_CKGR_MOR] |
221 | 221 | ||
222 | /* Wait for interrupt */ | 222 | /* Wait for interrupt */ |
223 | mcr p15, 0, tmp1, c7, c0, 4 | 223 | mcr p15, 0, tmp1, c7, c0, 4 |
224 | 224 | ||
225 | /* Turn on the main oscillator */ | 225 | /* Turn on the main oscillator */ |
226 | ldr tmp1, [pmc, #(AT91_CKGR_MOR - AT91_PMC)] | 226 | ldr tmp1, [pmc, #AT91_CKGR_MOR] |
227 | orr tmp1, tmp1, #AT91_PMC_MOSCEN | 227 | orr tmp1, tmp1, #AT91_PMC_MOSCEN |
228 | str tmp1, [pmc, #(AT91_CKGR_MOR - AT91_PMC)] | 228 | str tmp1, [pmc, #AT91_CKGR_MOR] |
229 | 229 | ||
230 | wait_moscrdy | 230 | wait_moscrdy |
231 | 231 | ||
232 | /* Restore PLLB setting */ | 232 | /* Restore PLLB setting */ |
233 | ldr tmp1, .saved_pllbr | 233 | ldr tmp1, .saved_pllbr |
234 | str tmp1, [pmc, #(AT91_CKGR_PLLBR - AT91_PMC)] | 234 | str tmp1, [pmc, #AT91_CKGR_PLLBR] |
235 | 235 | ||
236 | tst tmp1, #(AT91_PMC_MUL & 0xff0000) | 236 | tst tmp1, #(AT91_PMC_MUL & 0xff0000) |
237 | bne 1f | 237 | bne 1f |
@@ -243,7 +243,7 @@ sdr_sr_done: | |||
243 | 243 | ||
244 | /* Restore PLLA setting */ | 244 | /* Restore PLLA setting */ |
245 | ldr tmp1, .saved_pllar | 245 | ldr tmp1, .saved_pllar |
246 | str tmp1, [pmc, #(AT91_CKGR_PLLAR - AT91_PMC)] | 246 | str tmp1, [pmc, #AT91_CKGR_PLLAR] |
247 | 247 | ||
248 | tst tmp1, #(AT91_PMC_MUL & 0xff0000) | 248 | tst tmp1, #(AT91_PMC_MUL & 0xff0000) |
249 | bne 3f | 249 | bne 3f |
@@ -264,7 +264,7 @@ sdr_sr_done: | |||
264 | tst tmp1, #AT91_PMC_PRES | 264 | tst tmp1, #AT91_PMC_PRES |
265 | beq 2f | 265 | beq 2f |
266 | and tmp1, tmp1, #AT91_PMC_PRES | 266 | and tmp1, tmp1, #AT91_PMC_PRES |
267 | str tmp1, [pmc, #(AT91_PMC_MCKR - AT91_PMC)] | 267 | str tmp1, [pmc, #AT91_PMC_MCKR] |
268 | 268 | ||
269 | wait_mckrdy | 269 | wait_mckrdy |
270 | #endif | 270 | #endif |
@@ -273,7 +273,7 @@ sdr_sr_done: | |||
273 | * Restore master clock setting | 273 | * Restore master clock setting |
274 | */ | 274 | */ |
275 | 2: ldr tmp1, .saved_mckr | 275 | 2: ldr tmp1, .saved_mckr |
276 | str tmp1, [pmc, #(AT91_PMC_MCKR - AT91_PMC)] | 276 | str tmp1, [pmc, #AT91_PMC_MCKR] |
277 | 277 | ||
278 | wait_mckrdy | 278 | wait_mckrdy |
279 | 279 | ||