prm44xx.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * OMAP4 PRM module functions
  3. *
  4. * Copyright (C) 2011 Texas Instruments, Inc.
  5. * Copyright (C) 2010 Nokia Corporation
  6. * Benoît Cousson
  7. * Paul Walmsley
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/delay.h>
  15. #include <linux/errno.h>
  16. #include <linux/err.h>
  17. #include <linux/io.h>
  18. #include <plat/common.h>
  19. #include <plat/cpu.h>
  20. #include <plat/prcm.h>
  21. #include "prm44xx.h"
  22. #include "prm-regbits-44xx.h"
  23. /* PRM low-level functions */
  24. /* Read a register in a CM/PRM instance in the PRM module */
  25. u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
  26. {
  27. return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
  28. }
  29. /* Write into a register in a CM/PRM instance in the PRM module */
  30. void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
  31. {
  32. __raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
  33. }
  34. /* Read-modify-write a register in a PRM module. Caller must lock */
  35. u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
  36. {
  37. u32 v;
  38. v = omap4_prm_read_inst_reg(inst, reg);
  39. v &= ~mask;
  40. v |= bits;
  41. omap4_prm_write_inst_reg(v, inst, reg);
  42. return v;
  43. }