commandProcessing.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * OMAP3xxx PRM module functions
  3. *
  4. * Copyright (C) 2010-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/errno.h>
  16. #include <linux/err.h>
  17. #include <linux/io.h>
  18. #include <linux/irq.h>
  19. #include "soc.h"
  20. #include "common.h"
  21. #include "vp.h"
  22. #include "powerdomain.h"
  23. #include "prm3xxx.h"
  24. #include "prm2xxx_3xxx.h"
  25. #include "cm2xxx_3xxx.h"
  26. #include "prm-regbits-34xx.h"
  27. static const struct omap_prcm_irq omap3_prcm_irqs[] = {
  28. OMAP_PRCM_IRQ("wkup", 0, 0),
  29. OMAP_PRCM_IRQ("io", 9, 1),
  30. };
  31. static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
  32. .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
  33. .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
  34. .nr_regs = 1,
  35. .irqs = omap3_prcm_irqs,
  36. .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
  37. .irq = 11 + OMAP_INTC_START,
  38. .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
  39. .ocp_barrier = &omap3xxx_prm_ocp_barrier,
  40. .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
  41. .restore_irqen = &omap3xxx_prm_restore_irqen,
  42. };
  43. /*
  44. * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware
  45. * register (which are specific to OMAP3xxx SoCs) to reset source ID
  46. * bit shifts (which is an OMAP SoC-independent enumeration)
  47. */
  48. static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = {
  49. { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
  50. { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
  51. { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
  52. { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
  53. { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
  54. { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
  55. { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT,
  56. OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
  57. { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT,
  58. OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
  59. { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
  60. { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT },
  61. { -1, -1 },
  62. };
  63. /* PRM VP */
  64. /*
  65. * struct omap3_vp - OMAP3 VP register access description.
  66. * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
  67. */
  68. struct omap3_vp {
  69. u32 tranxdone_status;
  70. };
  71. static struct omap3_vp omap3_vp[] = {
  72. [OMAP3_VP_VDD_MPU_ID] = {
  73. .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
  74. },
  75. [OMAP3_VP_VDD_CORE_ID] = {
  76. .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
  77. },
  78. };
  79. #define MAX_VP_ID ARRAY_SIZE(omap3_vp);
  80. u32 omap3_prm_vp_check_txdone(u8 vp_id)
  81. {
  82. struct omap3_vp *vp = &omap3_vp[vp_id];
  83. u32 irqstatus;
  84. irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
  85. OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
  86. return irqstatus & vp->tranxdone_status;
  87. }
  88. void omap3_prm_vp_clear_txdone(u8 vp_id)
  89. {
  90. struct omap3_vp *vp = &omap3_vp[vp_id];
  91. omap2_prm_write_mod_reg(vp->tranxdone_status,
  92. OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
  93. }
  94. u32 omap3_prm_vcvp_read(u8 offset)
  95. {
  96. return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
  97. }
  98. void omap3_prm_vcvp_write(u32 val, u8 offset)
  99. {
  100. omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
  101. }
  102. u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
  103. {
  104. return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
  105. }
  106. /**
  107. * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC
  108. *
  109. * Set the DPLL3 reset bit, which should reboot the SoC. This is the
  110. * recommended way to restart the SoC, considering Errata i520. No
  111. * return value.
  112. */
  113. void omap3xxx_prm_dpll3_reset(void)