aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/mach-bf533/include
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2008-11-18 04:48:22 -0500
committerBryan Wu <cooloney@kernel.org>2008-11-18 04:48:22 -0500
commit53442e1cbdc1559cd39e0076adae6df64af36a3e (patch)
tree6513ffea1fcfdf488d5ec5e96f78fb2c2bc4b9f2 /arch/blackfin/mach-bf533/include
parentb94919e2da2f7acde842972a57fcd6dcc4a528db (diff)
Blackfin arch: delay PLL_CTL/VR_CTL wrappers
Delay PLL_CTL/VR_CTL wrappers as much as possible to avoid the inter-dependency problems with cdef and common headers Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/mach-bf533/include')
-rw-r--r--arch/blackfin/mach-bf533/include/mach/cdefBF532.h91
1 files changed, 47 insertions, 44 deletions
diff --git a/arch/blackfin/mach-bf533/include/mach/cdefBF532.h b/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
index 3d8978a52c17..24ff2cb967f6 100644
--- a/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
+++ b/arch/blackfin/mach-bf533/include/mach/cdefBF532.h
@@ -39,31 +39,8 @@
39/*include core specific register pointer definitions*/ 39/*include core specific register pointer definitions*/
40#include <asm/cdef_LPBlackfin.h> 40#include <asm/cdef_LPBlackfin.h>
41 41
42#include <asm/system.h>
43
44/* Clock and System Control (0xFFC0 0400-0xFFC0 07FF) */ 42/* Clock and System Control (0xFFC0 0400-0xFFC0 07FF) */
45#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL) 43#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
46/* Writing to PLL_CTL initiates a PLL relock sequence. */
47static __inline__ void bfin_write_PLL_CTL(unsigned int val)
48{
49 unsigned long flags, iwr;
50
51 if (val == bfin_read_PLL_CTL())
52 return;
53
54 local_irq_save(flags);
55 /* Enable the PLL Wakeup bit in SIC IWR */
56 iwr = bfin_read32(SIC_IWR);
57 /* Only allow PPL Wakeup) */
58 bfin_write32(SIC_IWR, IWR_ENABLE(0));
59
60 bfin_write16(PLL_CTL, val);
61 SSYNC();
62 asm("IDLE;");
63
64 bfin_write32(SIC_IWR, iwr);
65 local_irq_restore(flags);
66}
67#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT) 44#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
68#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val) 45#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT,val)
69#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT) 46#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
@@ -72,27 +49,6 @@ static __inline__ void bfin_write_PLL_CTL(unsigned int val)
72#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV) 49#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
73#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val) 50#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV,val)
74#define bfin_read_VR_CTL() bfin_read16(VR_CTL) 51#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
75/* Writing to VR_CTL initiates a PLL relock sequence. */
76static __inline__ void bfin_write_VR_CTL(unsigned int val)
77{
78 unsigned long flags, iwr;
79
80 if (val == bfin_read_VR_CTL())
81 return;
82
83 local_irq_save(flags);
84 /* Enable the PLL Wakeup bit in SIC IWR */
85 iwr = bfin_read32(SIC_IWR);
86 /* Only allow PPL Wakeup) */
87 bfin_write32(SIC_IWR, IWR_ENABLE(0));
88
89 bfin_write16(VR_CTL, val);
90 SSYNC();
91 asm("IDLE;");
92
93 bfin_write32(SIC_IWR, iwr);
94 local_irq_restore(flags);
95}
96 52
97/* System Interrupt Controller (0xFFC0 0C00-0xFFC0 0FFF) */ 53/* System Interrupt Controller (0xFFC0 0C00-0xFFC0 0FFF) */
98#define bfin_read_SWRST() bfin_read16(SWRST) 54#define bfin_read_SWRST() bfin_read16(SWRST)
@@ -764,4 +720,51 @@ BFIN_READ_FIO_FLAG(T)
764#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME) 720#define bfin_read_PPI_FRAME() bfin_read16(PPI_FRAME)
765#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME,val) 721#define bfin_write_PPI_FRAME(val) bfin_write16(PPI_FRAME,val)
766 722
723/* These need to be last due to the cdef/linux inter-dependencies */
724#include <asm/system.h>
725
726/* Writing to PLL_CTL initiates a PLL relock sequence. */
727static __inline__ void bfin_write_PLL_CTL(unsigned int val)
728{
729 unsigned long flags, iwr;
730
731 if (val == bfin_read_PLL_CTL())
732 return;
733
734 local_irq_save(flags);
735 /* Enable the PLL Wakeup bit in SIC IWR */
736 iwr = bfin_read32(SIC_IWR);
737 /* Only allow PPL Wakeup) */
738 bfin_write32(SIC_IWR, IWR_ENABLE(0));
739
740 bfin_write16(PLL_CTL, val);
741 SSYNC();
742 asm("IDLE;");
743
744 bfin_write32(SIC_IWR, iwr);
745 local_irq_restore(flags);
746}
747
748/* Writing to VR_CTL initiates a PLL relock sequence. */
749static __inline__ void bfin_write_VR_CTL(unsigned int val)
750{
751 unsigned long flags, iwr;
752
753 if (val == bfin_read_VR_CTL())
754 return;
755
756 local_irq_save(flags);
757 /* Enable the PLL Wakeup bit in SIC IWR */
758 iwr = bfin_read32(SIC_IWR);
759 /* Only allow PPL Wakeup) */
760 bfin_write32(SIC_IWR, IWR_ENABLE(0));
761
762 bfin_write16(VR_CTL, val);
763 SSYNC();
764 asm("IDLE;");
765
766 bfin_write32(SIC_IWR, iwr);
767 local_irq_restore(flags);
768}
769
767#endif /* _CDEF_BF532_H */ 770#endif /* _CDEF_BF532_H */