pll.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2005-2008 Analog Devices Inc.
  3. *
  4. * Licensed under the GPL-2 or later
  5. */
  6. #ifndef _MACH_PLL_H
  7. #define _MACH_PLL_H
  8. #include <asm/blackfin.h>
  9. #include <asm/irqflags.h>
  10. /* Writing to PLL_CTL initiates a PLL relock sequence. */
  11. static __inline__ void bfin_write_PLL_CTL(unsigned int val)
  12. {
  13. unsigned long flags, iwr;
  14. if (val == bfin_read_PLL_CTL())
  15. return;
  16. local_irq_save_hw(flags);
  17. /* Enable the PLL Wakeup bit in SIC IWR */
  18. iwr = bfin_read32(SIC_IWR);
  19. /* Only allow PPL Wakeup) */
  20. bfin_write32(SIC_IWR, IWR_ENABLE(0));
  21. bfin_write16(PLL_CTL, val);
  22. SSYNC();
  23. asm("IDLE;");
  24. bfin_write32(SIC_IWR, iwr);
  25. local_irq_restore_hw(flags);
  26. }
  27. /* Writing to VR_CTL initiates a PLL relock sequence. */
  28. static __inline__ void bfin_write_VR_CTL(unsigned int val)
  29. {
  30. unsigned long flags, iwr;
  31. if (val == bfin_read_VR_CTL())
  32. return;
  33. local_irq_save_hw(flags);
  34. /* Enable the PLL Wakeup bit in SIC IWR */
  35. iwr = bfin_read32(SIC_IWR);
  36. /* Only allow PPL Wakeup) */
  37. bfin_write32(SIC_IWR, IWR_ENABLE(0));
  38. bfin_write16(VR_CTL, val);
  39. SSYNC();
  40. asm("IDLE;");
  41. bfin_write32(SIC_IWR, iwr);
  42. local_irq_restore_hw(flags);
  43. }
  44. #endif /* _MACH_PLL_H */