prcm_mpu44xx.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * OMAP4 PRCM_MPU module functions
  3. *
  4. * Copyright (C) 2009 Nokia Corporation
  5. * Paul Walmsley
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/types.h>
  13. #include <linux/errno.h>
  14. #include <linux/err.h>
  15. #include <linux/io.h>
  16. #include "iomap.h"
  17. #include "common.h"
  18. #include "prcm_mpu44xx.h"
  19. #include "cm-regbits-44xx.h"
  20. /*
  21. * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
  22. * block registers
  23. */
  24. void __iomem *prcm_mpu_base;
  25. /* PRCM_MPU low-level functions */
  26. u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
  27. {
  28. return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
  29. }
  30. void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
  31. {
  32. writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
  33. }
  34. u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
  35. {
  36. u32 v;
  37. v = omap4_prcm_mpu_read_inst_reg(inst, reg);
  38. v &= ~mask;
  39. v |= bits;
  40. omap4_prcm_mpu_write_inst_reg(v, inst, reg);
  41. return v;
  42. }
  43. /**
  44. * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
  45. * @prcm_mpu: PRCM_MPU base virtual address
  46. *
  47. * XXX Will be replaced when the PRM/CM drivers are completed.
  48. */
  49. void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
  50. {
  51. prcm_mpu_base = prcm_mpu;
  52. }