preliminaryDataProcessing.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * OMAP4 PRM module functions
  3. *
  4. * Copyright (C) 2011-2012 Texas Instruments, Inc.
  5. * Copyright (C) 2010 Nokia Corporation
  6. * Benoît Cousson
  7. * Paul Walmsley
  8. * Rajendra Nayak <rnayak@ti.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/delay.h>
  16. #include <linux/errno.h>
  17. #include <linux/err.h>
  18. #include <linux/io.h>
  19. #include "soc.h"
  20. #include "iomap.h"
  21. #include "common.h"
  22. #include "vp.h"
  23. #include "prm44xx.h"
  24. #include "prm-regbits-44xx.h"
  25. #include "prcm44xx.h"
  26. #include "prminst44xx.h"
  27. #include "powerdomain.h"
  28. /* Static data */
  29. static const struct omap_prcm_irq omap4_prcm_irqs[] = {
  30. OMAP_PRCM_IRQ("wkup", 0, 0),
  31. OMAP_PRCM_IRQ("io", 9, 1),
  32. };
  33. static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
  34. .ack = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
  35. .mask = OMAP4_PRM_IRQENABLE_MPU_OFFSET,
  36. .nr_regs = 2,
  37. .irqs = omap4_prcm_irqs,
  38. .nr_irqs = ARRAY_SIZE(omap4_prcm_irqs),
  39. .irq = 11 + OMAP44XX_IRQ_GIC_START,
  40. .read_pending_irqs = &omap44xx_prm_read_pending_irqs,
  41. .ocp_barrier = &omap44xx_prm_ocp_barrier,
  42. .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
  43. .restore_irqen = &omap44xx_prm_restore_irqen,
  44. };
  45. /*
  46. * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
  47. * hardware register (which are specific to OMAP44xx SoCs) to reset
  48. * source ID bit shifts (which is an OMAP SoC-independent
  49. * enumeration)
  50. */
  51. static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
  52. { OMAP4430_GLOBAL_WARM_SW_RST_SHIFT,
  53. OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
  54. { OMAP4430_GLOBAL_COLD_RST_SHIFT,
  55. OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
  56. { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
  57. OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
  58. { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
  59. { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
  60. { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
  61. { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT,
  62. OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
  63. { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT,
  64. OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT },
  65. { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT,
  66. OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
  67. { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
  68. { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT },
  69. { -1, -1 },
  70. };
  71. /* PRM low-level functions */
  72. /* Read a register in a CM/PRM instance in the PRM module */
  73. u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
  74. {
  75. return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg));
  76. }
  77. /* Write into a register in a CM/PRM instance in the PRM module */
  78. void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
  79. {
  80. __raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg));
  81. }
  82. /* Read-modify-write a register in a PRM module. Caller must lock */
  83. u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
  84. {
  85. u32 v;
  86. v = omap4_prm_read_inst_reg(inst, reg);
  87. v &= ~mask;
  88. v |= bits;
  89. omap4_prm_write_inst_reg(v, inst, reg);