Edward-JW Yang | 1c7fd0b | 2021-06-28 11:29:51 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2021, MediaTek Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef MT_SPM_SSPM_INTC_H |
| 8 | #define MT_SPM_SSPM_INTC_H |
| 9 | |
| 10 | #include <mt_spm_reg.h> |
| 11 | |
| 12 | #define MT_SPM_SSPM_INTC_SEL_0 0x10 |
| 13 | #define MT_SPM_SSPM_INTC_SEL_1 0x20 |
| 14 | #define MT_SPM_SSPM_INTC_SEL_2 0x40 |
| 15 | #define MT_SPM_SSPM_INTC_SEL_3 0x80 |
| 16 | |
| 17 | #define MT_SPM_SSPM_INTC_TRIGGER(id, sg) \ |
| 18 | (((0x10 << id) | (sg << id)) & 0xff) |
| 19 | |
| 20 | #define MT_SPM_SSPM_INTC0_HIGH MT_SPM_SSPM_INTC_TRIGGER(0, 1) |
| 21 | #define MT_SPM_SSPM_INTC0_LOW MT_SPM_SSPM_INTC_TRIGGER(0, 0) |
| 22 | #define MT_SPM_SSPM_INTC1_HIGH MT_SPM_SSPM_INTC_TRIGGER(1, 1) |
| 23 | #define MT_SPM_SSPM_INTC1_LOW MT_SPM_SSPM_INTC_TRIGGER(1, 0) |
| 24 | #define MT_SPM_SSPM_INTC2_HIGH MT_SPM_SSPM_INTC_TRIGGER(2, 1) |
| 25 | #define MT_SPM_SSPM_INTC2_LOW MT_SPM_SSPM_INTC_TRIGGER(2, 0) |
| 26 | #define MT_SPM_SSPM_INTC3_HIGH MT_SPM_SSPM_INTC_TRIGGER(3, 1) |
| 27 | #define MT_SPM_SSPM_INTC3_LOW MT_SPM_SSPM_INTC_TRIGGER(3, 0) |
| 28 | |
| 29 | #define DO_SPM_SSPM_LP_SUSPEND() \ |
| 30 | mmio_write_32(SPM_MD32_IRQ, MT_SPM_SSPM_INTC0_HIGH) |
| 31 | #define DO_SPM_SSPM_LP_RESUME() \ |
| 32 | mmio_write_32(SPM_MD32_IRQ, MT_SPM_SSPM_INTC0_LOW) |
| 33 | #endif /* MT_SPM_SSPM_INTC_H */ |