Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | */ |
| 6 | |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 7 | #ifndef N200_ECLIC_H |
| 8 | #define N200_ECLIC_H |
| 9 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 10 | // Need to know the following info from the soc.h, so include soc.h here |
| 11 | // SOC_ECLIC_CTRL_ADDR : what is the base address of ECLIC in this SoC |
| 12 | // SOC_ECLIC_NUM_INTERRUPTS : how much of irq configured in total for the ECLIC in this SoC |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 13 | #include "soc.h" |
| 14 | |
bangzheng.liu | 68c0115 | 2022-09-29 16:57:22 +0800 | [diff] [blame] | 15 | //#define CLICINTCTLBITS 3 |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 16 | |
| 17 | //ECLIC memory map |
| 18 | // Offset |
| 19 | // 0x0000 1B RW cliccfg |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 20 | #define ECLIC_CFG_OFFSET 0x0 |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 21 | // 0x0004 4B R clicinfo |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 22 | #define ECLIC_INFO_OFFSET 0x4 |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 23 | // 0x000B 1B RW mintthresh |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 24 | #define ECLIC_MTH_OFFSET 0xB |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 25 | // |
| 26 | // 0x1000+4*i 1B/input RW clicintip[i] |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 27 | #define ECLIC_INT_IP_OFFSET _AC(0x1000, UL) |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 28 | // 0x1001+4*i 1B/input RW clicintie[i] |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 29 | #define ECLIC_INT_IE_OFFSET _AC(0x1001, UL) |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 30 | // 0x1002+4*i 1B/input RW clicintattr[i] |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 31 | #define ECLIC_INT_ATTR_OFFSET _AC(0x1002, UL) |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 32 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 33 | #define ECLIC_INT_ATTR_SHV 0x01 |
| 34 | #define ECLIC_INT_ATTR_TRIG_LEVEL 0x00 |
| 35 | #define ECLIC_INT_ATTR_TRIG_EDGE 0x02 |
| 36 | #define ECLIC_INT_ATTR_TRIG_POS 0x00 |
| 37 | #define ECLIC_INT_ATTR_TRIG_NEG 0x04 |
| 38 | #define ECLIC_INT_ATTR_MACH_MODE 0xC0 |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 39 | |
| 40 | // 0x1003+4*i 1B/input RW clicintctl[i] |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 41 | #define ECLIC_INT_CTRL_OFFSET _AC(0x1003, UL) |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 42 | // |
| 43 | // ... |
| 44 | // |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 45 | #define ECLIC_ADDR_BASE SOC_ECLIC_CTRL_ADDR |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 46 | |
| 47 | #define ECLIC_INTERNAL_NUM_INTERRUPTS 19 |
| 48 | #define ECLIC_NUM_INTERRUPTS (SOC_ECLIC_NUM_INTERRUPTS + ECLIC_INTERNAL_NUM_INTERRUPTS) |
| 49 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 50 | #define ECLIC_CFG_NLBITS_MASK _AC(0x1E, UL) |
| 51 | #define ECLIC_CFG_NLBITS_LSB (1u) |
bangzheng.liu | 68c0115 | 2022-09-29 16:57:22 +0800 | [diff] [blame] | 52 | #define ECLIC_INFO_CLICINTCTLBITS_MASK _AC(0x1E00000, UL) |
| 53 | #define ECLIC_INFO_CLICINTCTLBITS_LSB (21u) |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 54 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 55 | #define ECLIC_INT_MSIP 3 |
| 56 | #define ECLIC_INT_MTIP 7 |
| 57 | #define ECLIC_INT_MEIP 11 |
bangzheng.liu | 17e8698 | 2024-06-18 20:04:34 +0800 | [diff] [blame] | 58 | #define ECLIC_INT_BUS_RESP_ERR 17 |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 59 | |
bangzheng.liu | 17e8698 | 2024-06-18 20:04:34 +0800 | [diff] [blame] | 60 | #define BUS_RESP_ERR_HANDLER eclic_inner_irq17_handler |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 61 | #define BUTTON_1_HANDLER eclic_irq49_handler |
| 62 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 63 | #define MTIME_HANDLER eclic_mtip_handler |
| 64 | #define SSIP_HANDLER eclic_ssip_handler |
| 65 | #define MSIP_HANDLER eclic_msip_handler |
| 66 | #define UTIP_HANDLER eclic_utip_handler |
| 67 | #define STIP_HANDLER eclic_stip_handler |
| 68 | #define IRQ7_HANDLER eclic_irq7_handler |
| 69 | #define UEIP_HANDLER eclic_ueip_handler |
| 70 | #define SEIP_HANDLER eclic_seip_handler |
| 71 | #define MEIP_HANDLER eclic_meip_handler |
| 72 | #define IMECCI_HANDLER eclic_imecci_handler |
| 73 | #define BWEI_HANDLER eclic_bwei_handler |
| 74 | #define PMOVI_HANDLER eclic_pmovi_handler |
Xiaohu.Huang | a2c5a04 | 2022-03-12 22:41:09 +0800 | [diff] [blame] | 75 | |
| 76 | #endif |