Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 1 | /* |
Paul Walmsley | 59fb659 | 2010-12-21 15:30:55 -0700 | [diff] [blame] | 2 | * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 3 | * |
Paul Walmsley | d9a16f9 | 2012-10-29 20:57:39 -0600 | [diff] [blame] | 4 | * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc. |
BenoƮt Cousson | 0be1621 | 2010-09-21 10:34:10 -0600 | [diff] [blame] | 5 | * Copyright (C) 2010 Nokia Corporation |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 6 | * |
Paul Walmsley | 59fb659 | 2010-12-21 15:30:55 -0700 | [diff] [blame] | 7 | * Paul Walmsley |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 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 | */ |
Paul Walmsley | 59fb659 | 2010-12-21 15:30:55 -0700 | [diff] [blame] | 13 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM_H |
| 14 | #define __ARCH_ARM_MACH_OMAP2_PRM_H |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 15 | |
| 16 | #include "prcm-common.h" |
| 17 | |
Paul Walmsley | d9a16f9 | 2012-10-29 20:57:39 -0600 | [diff] [blame] | 18 | # ifndef __ASSEMBLER__ |
| 19 | extern void __iomem *prm_base; |
| 20 | extern void omap2_set_globals_prm(void __iomem *prm); |
| 21 | # endif |
| 22 | |
Paul Walmsley | b13159a | 2012-10-29 20:57:44 -0600 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP |
| 26 | * module to softreset |
| 27 | */ |
| 28 | #define MAX_MODULE_SOFTRESET_WAIT 10000 |
| 29 | |
| 30 | /* |
| 31 | * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP |
| 32 | * submodule to exit hardreset |
| 33 | */ |
| 34 | #define MAX_MODULE_HARDRESET_WAIT 10000 |
| 35 | |
| 36 | /* |
| 37 | * Register bitfields |
| 38 | */ |
| 39 | |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 40 | /* |
| 41 | * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP |
| 42 | * |
| 43 | * 2430: PM_PWSTST_MDM |
| 44 | * |
| 45 | * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX, |
| 46 | * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU, |
| 47 | * PM_PWSTST_NEON |
| 48 | */ |
Paul Walmsley | 2fd0f75 | 2010-05-18 18:40:23 -0600 | [diff] [blame] | 49 | #define OMAP_INTRANSITION_MASK (1 << 20) |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 50 | |
| 51 | |
| 52 | /* |
| 53 | * 24XX: PM_PWSTST_GFX, PM_PWSTST_DSP |
| 54 | * |
| 55 | * 2430: PM_PWSTST_MDM |
| 56 | * |
| 57 | * 3430: PM_PWSTST_IVA2, PM_PWSTST_MPU, PM_PWSTST_CORE, PM_PWSTST_GFX, |
| 58 | * PM_PWSTST_DSS, PM_PWSTST_CAM, PM_PWSTST_PER, PM_PWSTST_EMU, |
| 59 | * PM_PWSTST_NEON |
| 60 | */ |
| 61 | #define OMAP_POWERSTATEST_SHIFT 0 |
| 62 | #define OMAP_POWERSTATEST_MASK (0x3 << 0) |
| 63 | |
| 64 | /* |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 65 | * 24XX: PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, PM_PWSTCTRL_GFX, |
| 66 | * PM_PWSTCTRL_DSP, PM_PWSTST_MPU |
| 67 | * |
| 68 | * 2430: PM_PWSTCTRL_MDM shared bits |
| 69 | * |
| 70 | * 3430: PM_PWSTCTRL_IVA2, PM_PWSTCTRL_MPU, PM_PWSTCTRL_CORE, |
| 71 | * PM_PWSTCTRL_GFX, PM_PWSTCTRL_DSS, PM_PWSTCTRL_CAM, PM_PWSTCTRL_PER, |
| 72 | * PM_PWSTCTRL_NEON shared bits |
| 73 | */ |
| 74 | #define OMAP_POWERSTATE_SHIFT 0 |
| 75 | #define OMAP_POWERSTATE_MASK (0x3 << 0) |
| 76 | |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 77 | /* |
| 78 | * Standardized OMAP reset source bits |
| 79 | * |
| 80 | * To the extent these happen to match the hardware register bit |
| 81 | * shifts, it's purely coincidental. Used by omap-wdt.c. |
| 82 | * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever |
| 83 | * there are any bits remaining in the global PRM_RSTST register that |
| 84 | * haven't been identified, or when the PRM code for the current SoC |
| 85 | * doesn't know how to interpret the register. |
| 86 | */ |
| 87 | #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0 |
| 88 | #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1 |
| 89 | #define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2 |
| 90 | #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3 |
| 91 | #define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4 |
| 92 | #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 |
| 93 | #define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6 |
| 94 | #define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7 |
| 95 | #define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8 |
| 96 | #define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9 |
| 97 | #define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10 |
| 98 | #define OMAP_C2C_RST_SRC_ID_SHIFT 11 |
| 99 | #define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12 |
| 100 | |
Paul Walmsley | e24c357 | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 101 | #ifndef __ASSEMBLER__ |
| 102 | |
| 103 | /** |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 104 | * struct prm_reset_src_map - map register bitshifts to standard bitshifts |
| 105 | * @reg_shift: bitshift in the PRM reset source register |
| 106 | * @std_shift: bitshift equivalent in the standard reset source list |
| 107 | * |
| 108 | * The fields are signed because -1 is used as a terminator. |
Paul Walmsley | e24c357 | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 109 | */ |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 110 | struct prm_reset_src_map { |
| 111 | s8 reg_shift; |
| 112 | s8 std_shift; |
| 113 | }; |
| 114 | |
| 115 | /** |
| 116 | * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations |
Rajendra Nayak | e6d3a8b | 2012-11-21 16:15:17 -0700 | [diff] [blame] | 117 | * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl |
| 118 | * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn |
| 119 | * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn |
| 120 | * |
| 121 | * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are |
| 122 | * deprecated. |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 123 | */ |
| 124 | struct prm_ll_data { |
| 125 | u32 (*read_reset_sources)(void); |
Rajendra Nayak | e6d3a8b | 2012-11-21 16:15:17 -0700 | [diff] [blame] | 126 | bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); |
| 127 | void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 128 | }; |
Paul Walmsley | e24c357 | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 129 | |
| 130 | extern int prm_register(struct prm_ll_data *pld); |
| 131 | extern int prm_unregister(struct prm_ll_data *pld); |
| 132 | |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 133 | extern u32 prm_read_reset_sources(void); |
Rajendra Nayak | e6d3a8b | 2012-11-21 16:15:17 -0700 | [diff] [blame] | 134 | extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx); |
| 135 | extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx); |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 136 | |
Paul Walmsley | e24c357 | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 137 | #endif |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 138 | |
Paul Walmsley | 2bb2a5d | 2012-10-21 01:01:13 -0600 | [diff] [blame] | 139 | |
Paul Walmsley | 69d88a0 | 2008-03-18 10:02:50 +0200 | [diff] [blame] | 140 | #endif |