162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * IRQ mappings for Loongson 1
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __ASM_MACH_LOONGSON32_IRQ_H
962306a36Sopenharmony_ci#define __ASM_MACH_LOONGSON32_IRQ_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * CPU core Interrupt Numbers
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci#define MIPS_CPU_IRQ_BASE		0
1562306a36Sopenharmony_ci#define MIPS_CPU_IRQ(x)			(MIPS_CPU_IRQ_BASE + (x))
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define SOFTINT0_IRQ			MIPS_CPU_IRQ(0)
1862306a36Sopenharmony_ci#define SOFTINT1_IRQ			MIPS_CPU_IRQ(1)
1962306a36Sopenharmony_ci#define INT0_IRQ			MIPS_CPU_IRQ(2)
2062306a36Sopenharmony_ci#define INT1_IRQ			MIPS_CPU_IRQ(3)
2162306a36Sopenharmony_ci#define INT2_IRQ			MIPS_CPU_IRQ(4)
2262306a36Sopenharmony_ci#define INT3_IRQ			MIPS_CPU_IRQ(5)
2362306a36Sopenharmony_ci#define INT4_IRQ			MIPS_CPU_IRQ(6)
2462306a36Sopenharmony_ci#define TIMER_IRQ			MIPS_CPU_IRQ(7)		/* cpu timer */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define MIPS_CPU_IRQS		(MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/*
2962306a36Sopenharmony_ci * INT0~3 Interrupt Numbers
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_ci#define LS1X_IRQ_BASE			MIPS_CPU_IRQS
3262306a36Sopenharmony_ci#define LS1X_IRQ(n, x)			(LS1X_IRQ_BASE + (n << 5) + (x))
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define LS1X_UART0_IRQ			LS1X_IRQ(0, 2)
3562306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
3662306a36Sopenharmony_ci#define LS1X_UART1_IRQ			LS1X_IRQ(0, 3)
3762306a36Sopenharmony_ci#define LS1X_UART2_IRQ			LS1X_IRQ(0, 4)
3862306a36Sopenharmony_ci#define LS1X_UART3_IRQ			LS1X_IRQ(0, 5)
3962306a36Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
4062306a36Sopenharmony_ci#define LS1X_UART1_IRQ			LS1X_IRQ(0, 4)
4162306a36Sopenharmony_ci#define LS1X_UART2_IRQ			LS1X_IRQ(0, 5)
4262306a36Sopenharmony_ci#endif
4362306a36Sopenharmony_ci#define LS1X_CAN0_IRQ			LS1X_IRQ(0, 6)
4462306a36Sopenharmony_ci#define LS1X_CAN1_IRQ			LS1X_IRQ(0, 7)
4562306a36Sopenharmony_ci#define LS1X_SPI0_IRQ			LS1X_IRQ(0, 8)
4662306a36Sopenharmony_ci#define LS1X_SPI1_IRQ			LS1X_IRQ(0, 9)
4762306a36Sopenharmony_ci#define LS1X_AC97_IRQ			LS1X_IRQ(0, 10)
4862306a36Sopenharmony_ci#define LS1X_DMA0_IRQ			LS1X_IRQ(0, 13)
4962306a36Sopenharmony_ci#define LS1X_DMA1_IRQ			LS1X_IRQ(0, 14)
5062306a36Sopenharmony_ci#define LS1X_DMA2_IRQ			LS1X_IRQ(0, 15)
5162306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1C)
5262306a36Sopenharmony_ci#define LS1X_NAND_IRQ			LS1X_IRQ(0, 16)
5362306a36Sopenharmony_ci#endif
5462306a36Sopenharmony_ci#define LS1X_PWM0_IRQ			LS1X_IRQ(0, 17)
5562306a36Sopenharmony_ci#define LS1X_PWM1_IRQ			LS1X_IRQ(0, 18)
5662306a36Sopenharmony_ci#define LS1X_PWM2_IRQ			LS1X_IRQ(0, 19)
5762306a36Sopenharmony_ci#define LS1X_PWM3_IRQ			LS1X_IRQ(0, 20)
5862306a36Sopenharmony_ci#define LS1X_RTC_INT0_IRQ		LS1X_IRQ(0, 21)
5962306a36Sopenharmony_ci#define LS1X_RTC_INT1_IRQ		LS1X_IRQ(0, 22)
6062306a36Sopenharmony_ci#define LS1X_RTC_INT2_IRQ		LS1X_IRQ(0, 23)
6162306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
6262306a36Sopenharmony_ci#define LS1X_TOY_INT0_IRQ		LS1X_IRQ(0, 24)
6362306a36Sopenharmony_ci#define LS1X_TOY_INT1_IRQ		LS1X_IRQ(0, 25)
6462306a36Sopenharmony_ci#define LS1X_TOY_INT2_IRQ		LS1X_IRQ(0, 26)
6562306a36Sopenharmony_ci#define LS1X_RTC_TICK_IRQ		LS1X_IRQ(0, 27)
6662306a36Sopenharmony_ci#define LS1X_TOY_TICK_IRQ		LS1X_IRQ(0, 28)
6762306a36Sopenharmony_ci#define LS1X_UART4_IRQ			LS1X_IRQ(0, 29)
6862306a36Sopenharmony_ci#define LS1X_UART5_IRQ			LS1X_IRQ(0, 30)
6962306a36Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
7062306a36Sopenharmony_ci#define LS1X_UART3_IRQ			LS1X_IRQ(0, 29)
7162306a36Sopenharmony_ci#define LS1X_ADC_IRQ			LS1X_IRQ(0, 30)
7262306a36Sopenharmony_ci#define LS1X_SDIO_IRQ			LS1X_IRQ(0, 31)
7362306a36Sopenharmony_ci#endif
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define LS1X_EHCI_IRQ			LS1X_IRQ(1, 0)
7662306a36Sopenharmony_ci#define LS1X_OHCI_IRQ			LS1X_IRQ(1, 1)
7762306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
7862306a36Sopenharmony_ci#define LS1X_GMAC0_IRQ			LS1X_IRQ(1, 2)
7962306a36Sopenharmony_ci#define LS1X_GMAC1_IRQ			LS1X_IRQ(1, 3)
8062306a36Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
8162306a36Sopenharmony_ci#define LS1X_OTG_IRQ			LS1X_IRQ(1, 2)
8262306a36Sopenharmony_ci#define LS1X_GMAC0_IRQ			LS1X_IRQ(1, 3)
8362306a36Sopenharmony_ci#define LS1X_CAM_IRQ			LS1X_IRQ(1, 4)
8462306a36Sopenharmony_ci#define LS1X_UART4_IRQ			LS1X_IRQ(1, 5)
8562306a36Sopenharmony_ci#define LS1X_UART5_IRQ			LS1X_IRQ(1, 6)
8662306a36Sopenharmony_ci#define LS1X_UART6_IRQ			LS1X_IRQ(1, 7)
8762306a36Sopenharmony_ci#define LS1X_UART7_IRQ			LS1X_IRQ(1, 8)
8862306a36Sopenharmony_ci#define LS1X_UART8_IRQ			LS1X_IRQ(1, 9)
8962306a36Sopenharmony_ci#define LS1X_UART9_IRQ			LS1X_IRQ(1, 13)
9062306a36Sopenharmony_ci#define LS1X_UART10_IRQ			LS1X_IRQ(1, 14)
9162306a36Sopenharmony_ci#define LS1X_UART11_IRQ			LS1X_IRQ(1, 15)
9262306a36Sopenharmony_ci#define LS1X_I2C0_IRQ			LS1X_IRQ(1, 17)
9362306a36Sopenharmony_ci#define LS1X_I2C1_IRQ			LS1X_IRQ(1, 18)
9462306a36Sopenharmony_ci#define LS1X_I2C2_IRQ			LS1X_IRQ(1, 19)
9562306a36Sopenharmony_ci#endif
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
9862306a36Sopenharmony_ci#define INTN	4
9962306a36Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
10062306a36Sopenharmony_ci#define INTN	5
10162306a36Sopenharmony_ci#endif
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define LS1X_IRQS		(LS1X_IRQ(INTN, 31) + 1 - LS1X_IRQ_BASE)
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define NR_IRQS			(MIPS_CPU_IRQS + LS1X_IRQS)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#endif /* __ASM_MACH_LOONGSON32_IRQ_H */
108