prcm_mpu44xx.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * OMAP4 PRCM_MPU module functions
  4. *
  5. * Copyright (C) 2009 Nokia Corporation
  6. * Paul Walmsley
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/types.h>
  10. #include <linux/errno.h>
  11. #include <linux/err.h>
  12. #include <linux/io.h>
  13. #include "iomap.h"
  14. #include "common.h"
  15. #include "prcm_mpu44xx.h"
  16. #include "cm-regbits-44xx.h"
  17. /*
  18. * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
  19. * block registers
  20. */
  21. struct omap_domain_base prcm_mpu_base;
  22. /* PRCM_MPU low-level functions */
  23. u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
  24. {
  25. return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
  26. }
  27. void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
  28. {
  29. writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
  30. }
  31. u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
  32. {
  33. u32 v;
  34. v = omap4_prcm_mpu_read_inst_reg(inst, reg);
  35. v &= ~mask;
  36. v |= bits;
  37. omap4_prcm_mpu_write_inst_reg(v, inst, reg);
  38. return v;
  39. }
  40. /**
  41. * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
  42. * @prcm_mpu: PRCM_MPU base virtual address
  43. *
  44. * XXX Will be replaced when the PRM/CM drivers are completed.
  45. */
  46. void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
  47. {
  48. prcm_mpu_base.va = prcm_mpu;
  49. }