|
@@ -29,18 +29,71 @@
|
|
|
*/
|
|
|
|
|
|
#ifndef _CDEF_BF52X_H
|
|
|
+#define _CDEF_BF52X_H
|
|
|
+
|
|
|
+#include <asm/system.h>
|
|
|
+#include <asm/blackfin.h>
|
|
|
|
|
|
#include "defBF52x_base.h"
|
|
|
|
|
|
+/* Include core specific register pointer definitions */
|
|
|
+#include <asm/mach-common/cdef_LPBlackfin.h>
|
|
|
+
|
|
|
/* ==== begin from cdefBF534.h ==== */
|
|
|
|
|
|
/* Clock and System Control (0xFFC00000 - 0xFFC000FF) */
|
|
|
#define bfin_read_PLL_CTL() bfin_read16(PLL_CTL)
|
|
|
-#define bfin_write_PLL_CTL(val) bfin_write16(PLL_CTL, val)
|
|
|
+/* Writing to PLL_CTL initiates a PLL relock sequence. */
|
|
|
+static __inline__ void bfin_write_PLL_CTL(unsigned int val)
|
|
|
+{
|
|
|
+ unsigned long flags, iwr0, iwr1;
|
|
|
+
|
|
|
+ if (val == bfin_read_PLL_CTL())
|
|
|
+ return;
|
|
|
+
|
|
|
+ local_irq_save(flags);
|
|
|
+ /* Enable the PLL Wakeup bit in SIC IWR */
|
|
|
+ iwr0 = bfin_read32(SIC_IWR0);
|
|
|
+ iwr1 = bfin_read32(SIC_IWR1);
|
|
|
+ /* Only allow PPL Wakeup) */
|
|
|
+ bfin_write32(SIC_IWR0, IWR_ENABLE(0));
|
|
|
+ bfin_write32(SIC_IWR1, 0);
|
|
|
+
|
|
|
+ bfin_write16(PLL_CTL, val);
|
|
|
+ SSYNC();
|
|
|
+ asm("IDLE;");
|
|
|
+
|
|
|
+ bfin_write32(SIC_IWR0, iwr0);
|
|
|
+ bfin_write32(SIC_IWR1, iwr1);
|
|
|
+ local_irq_restore(flags);
|
|
|
+}
|
|
|
#define bfin_read_PLL_DIV() bfin_read16(PLL_DIV)
|
|
|
#define bfin_write_PLL_DIV(val) bfin_write16(PLL_DIV, val)
|
|
|
#define bfin_read_VR_CTL() bfin_read16(VR_CTL)
|
|
|
-#define bfin_write_VR_CTL(val) bfin_write16(VR_CTL, val)
|
|
|
+/* Writing to VR_CTL initiates a PLL relock sequence. */
|
|
|
+static __inline__ void bfin_write_VR_CTL(unsigned int val)
|
|
|
+{
|
|
|
+ unsigned long flags, iwr0, iwr1;
|
|
|
+
|
|
|
+ if (val == bfin_read_VR_CTL())
|
|
|
+ return;
|
|
|
+
|
|
|
+ local_irq_save(flags);
|
|
|
+ /* Enable the PLL Wakeup bit in SIC IWR */
|
|
|
+ iwr0 = bfin_read32(SIC_IWR0);
|
|
|
+ iwr1 = bfin_read32(SIC_IWR1);
|
|
|
+ /* Only allow PPL Wakeup) */
|
|
|
+ bfin_write32(SIC_IWR0, IWR_ENABLE(0));
|
|
|
+ bfin_write32(SIC_IWR1, 0);
|
|
|
+
|
|
|
+ bfin_write16(VR_CTL, val);
|
|
|
+ SSYNC();
|
|
|
+ asm("IDLE;");
|
|
|
+
|
|
|
+ bfin_write32(SIC_IWR0, iwr0);
|
|
|
+ bfin_write32(SIC_IWR1, iwr1);
|
|
|
+ local_irq_restore(flags);
|
|
|
+}
|
|
|
#define bfin_read_PLL_STAT() bfin_read16(PLL_STAT)
|
|
|
#define bfin_write_PLL_STAT(val) bfin_write16(PLL_STAT, val)
|
|
|
#define bfin_read_PLL_LOCKCNT() bfin_read16(PLL_LOCKCNT)
|