18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* linux/arch/arm/mach-s3c64xx/include/mach/irqs.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 2008 Openmoko, Inc.
58c2ecf20Sopenharmony_ci * Copyright 2008 Simtec Electronics
68c2ecf20Sopenharmony_ci *      Ben Dooks <ben@simtec.co.uk>
78c2ecf20Sopenharmony_ci *      http://armlinux.simtec.co.uk/
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * S3C64XX - IRQ support
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_S3C64XX_IRQS_H
138c2ecf20Sopenharmony_ci#define __ASM_MACH_S3C64XX_IRQS_H __FILE__
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* we keep the first set of CPU IRQs out of the range of
168c2ecf20Sopenharmony_ci * the ISA space, so that the PC104 has them to itself
178c2ecf20Sopenharmony_ci * and we don't end up having to do horrible things to the
188c2ecf20Sopenharmony_ci * standard ISA drivers....
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * note, since we're using the VICs, our start must be a
218c2ecf20Sopenharmony_ci * mulitple of 32 to allow the common code to work
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define S3C_IRQ_OFFSET	(32)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define S3C_IRQ(x)	((x) + S3C_IRQ_OFFSET)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define IRQ_VIC0_BASE	S3C_IRQ(0)
298c2ecf20Sopenharmony_ci#define IRQ_VIC1_BASE	S3C_IRQ(32)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* VIC based IRQs */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define S3C64XX_IRQ_VIC0(x)	(IRQ_VIC0_BASE + (x))
348c2ecf20Sopenharmony_ci#define S3C64XX_IRQ_VIC1(x)	(IRQ_VIC1_BASE + (x))
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* VIC0 */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define IRQ_EINT0_3		S3C64XX_IRQ_VIC0(0)
398c2ecf20Sopenharmony_ci#define IRQ_EINT4_11		S3C64XX_IRQ_VIC0(1)
408c2ecf20Sopenharmony_ci#define IRQ_RTC_TIC		S3C64XX_IRQ_VIC0(2)
418c2ecf20Sopenharmony_ci#define IRQ_CAMIF_C		S3C64XX_IRQ_VIC0(3)
428c2ecf20Sopenharmony_ci#define IRQ_CAMIF_P		S3C64XX_IRQ_VIC0(4)
438c2ecf20Sopenharmony_ci#define IRQ_CAMIF_MC		S3C64XX_IRQ_VIC0(5)
448c2ecf20Sopenharmony_ci#define IRQ_S3C6410_IIC1	S3C64XX_IRQ_VIC0(5)
458c2ecf20Sopenharmony_ci#define IRQ_S3C6410_IIS		S3C64XX_IRQ_VIC0(6)
468c2ecf20Sopenharmony_ci#define IRQ_S3C6400_CAMIF_MP	S3C64XX_IRQ_VIC0(6)
478c2ecf20Sopenharmony_ci#define IRQ_CAMIF_WE_C		S3C64XX_IRQ_VIC0(7)
488c2ecf20Sopenharmony_ci#define IRQ_S3C6410_G3D		S3C64XX_IRQ_VIC0(8)
498c2ecf20Sopenharmony_ci#define IRQ_S3C6400_CAMIF_WE_P	S3C64XX_IRQ_VIC0(8)
508c2ecf20Sopenharmony_ci#define IRQ_POST0		S3C64XX_IRQ_VIC0(9)
518c2ecf20Sopenharmony_ci#define IRQ_ROTATOR		S3C64XX_IRQ_VIC0(10)
528c2ecf20Sopenharmony_ci#define IRQ_2D			S3C64XX_IRQ_VIC0(11)
538c2ecf20Sopenharmony_ci#define IRQ_TVENC		S3C64XX_IRQ_VIC0(12)
548c2ecf20Sopenharmony_ci#define IRQ_SCALER		S3C64XX_IRQ_VIC0(13)
558c2ecf20Sopenharmony_ci#define IRQ_BATF		S3C64XX_IRQ_VIC0(14)
568c2ecf20Sopenharmony_ci#define IRQ_JPEG		S3C64XX_IRQ_VIC0(15)
578c2ecf20Sopenharmony_ci#define IRQ_MFC			S3C64XX_IRQ_VIC0(16)
588c2ecf20Sopenharmony_ci#define IRQ_SDMA0		S3C64XX_IRQ_VIC0(17)
598c2ecf20Sopenharmony_ci#define IRQ_SDMA1		S3C64XX_IRQ_VIC0(18)
608c2ecf20Sopenharmony_ci#define IRQ_ARM_DMAERR		S3C64XX_IRQ_VIC0(19)
618c2ecf20Sopenharmony_ci#define IRQ_ARM_DMA		S3C64XX_IRQ_VIC0(20)
628c2ecf20Sopenharmony_ci#define IRQ_ARM_DMAS		S3C64XX_IRQ_VIC0(21)
638c2ecf20Sopenharmony_ci#define IRQ_KEYPAD		S3C64XX_IRQ_VIC0(22)
648c2ecf20Sopenharmony_ci#define IRQ_TIMER0_VIC		S3C64XX_IRQ_VIC0(23)
658c2ecf20Sopenharmony_ci#define IRQ_TIMER1_VIC		S3C64XX_IRQ_VIC0(24)
668c2ecf20Sopenharmony_ci#define IRQ_TIMER2_VIC		S3C64XX_IRQ_VIC0(25)
678c2ecf20Sopenharmony_ci#define IRQ_WDT			S3C64XX_IRQ_VIC0(26)
688c2ecf20Sopenharmony_ci#define IRQ_TIMER3_VIC		S3C64XX_IRQ_VIC0(27)
698c2ecf20Sopenharmony_ci#define IRQ_TIMER4_VIC		S3C64XX_IRQ_VIC0(28)
708c2ecf20Sopenharmony_ci#define IRQ_LCD_FIFO		S3C64XX_IRQ_VIC0(29)
718c2ecf20Sopenharmony_ci#define IRQ_LCD_VSYNC		S3C64XX_IRQ_VIC0(30)
728c2ecf20Sopenharmony_ci#define IRQ_LCD_SYSTEM		S3C64XX_IRQ_VIC0(31)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* VIC1 */
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define IRQ_EINT12_19		S3C64XX_IRQ_VIC1(0)
778c2ecf20Sopenharmony_ci#define IRQ_EINT20_27		S3C64XX_IRQ_VIC1(1)
788c2ecf20Sopenharmony_ci#define IRQ_PCM0		S3C64XX_IRQ_VIC1(2)
798c2ecf20Sopenharmony_ci#define IRQ_PCM1		S3C64XX_IRQ_VIC1(3)
808c2ecf20Sopenharmony_ci#define IRQ_AC97		S3C64XX_IRQ_VIC1(4)
818c2ecf20Sopenharmony_ci#define IRQ_UART0		S3C64XX_IRQ_VIC1(5)
828c2ecf20Sopenharmony_ci#define IRQ_UART1		S3C64XX_IRQ_VIC1(6)
838c2ecf20Sopenharmony_ci#define IRQ_UART2		S3C64XX_IRQ_VIC1(7)
848c2ecf20Sopenharmony_ci#define IRQ_UART3		S3C64XX_IRQ_VIC1(8)
858c2ecf20Sopenharmony_ci#define IRQ_DMA0		S3C64XX_IRQ_VIC1(9)
868c2ecf20Sopenharmony_ci#define IRQ_DMA1		S3C64XX_IRQ_VIC1(10)
878c2ecf20Sopenharmony_ci#define IRQ_ONENAND0		S3C64XX_IRQ_VIC1(11)
888c2ecf20Sopenharmony_ci#define IRQ_ONENAND1		S3C64XX_IRQ_VIC1(12)
898c2ecf20Sopenharmony_ci#define IRQ_NFC			S3C64XX_IRQ_VIC1(13)
908c2ecf20Sopenharmony_ci#define IRQ_CFCON		S3C64XX_IRQ_VIC1(14)
918c2ecf20Sopenharmony_ci#define IRQ_USBH		S3C64XX_IRQ_VIC1(15)
928c2ecf20Sopenharmony_ci#define IRQ_SPI0		S3C64XX_IRQ_VIC1(16)
938c2ecf20Sopenharmony_ci#define IRQ_SPI1		S3C64XX_IRQ_VIC1(17)
948c2ecf20Sopenharmony_ci#define IRQ_IIC			S3C64XX_IRQ_VIC1(18)
958c2ecf20Sopenharmony_ci#define IRQ_HSItx		S3C64XX_IRQ_VIC1(19)
968c2ecf20Sopenharmony_ci#define IRQ_HSIrx		S3C64XX_IRQ_VIC1(20)
978c2ecf20Sopenharmony_ci#define IRQ_RESERVED		S3C64XX_IRQ_VIC1(21)
988c2ecf20Sopenharmony_ci#define IRQ_MSM			S3C64XX_IRQ_VIC1(22)
998c2ecf20Sopenharmony_ci#define IRQ_HOSTIF		S3C64XX_IRQ_VIC1(23)
1008c2ecf20Sopenharmony_ci#define IRQ_HSMMC0		S3C64XX_IRQ_VIC1(24)
1018c2ecf20Sopenharmony_ci#define IRQ_HSMMC1		S3C64XX_IRQ_VIC1(25)
1028c2ecf20Sopenharmony_ci#define IRQ_HSMMC2		IRQ_SPI1	/* shared with SPI1 */
1038c2ecf20Sopenharmony_ci#define IRQ_OTG			S3C64XX_IRQ_VIC1(26)
1048c2ecf20Sopenharmony_ci#define IRQ_IRDA		S3C64XX_IRQ_VIC1(27)
1058c2ecf20Sopenharmony_ci#define IRQ_RTC_ALARM		S3C64XX_IRQ_VIC1(28)
1068c2ecf20Sopenharmony_ci#define IRQ_SEC			S3C64XX_IRQ_VIC1(29)
1078c2ecf20Sopenharmony_ci#define IRQ_PENDN		S3C64XX_IRQ_VIC1(30)
1088c2ecf20Sopenharmony_ci#define IRQ_TC			IRQ_PENDN
1098c2ecf20Sopenharmony_ci#define IRQ_ADC			S3C64XX_IRQ_VIC1(31)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/* compatibility for device defines */
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define IRQ_IIC1		IRQ_S3C6410_IIC1
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
1168c2ecf20Sopenharmony_ci * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
1178c2ecf20Sopenharmony_ci * which we place after the pair of VICs. */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define S3C_IRQ_EINT_BASE	S3C_IRQ(64+5)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define S3C_EINT(x)		((x) + S3C_IRQ_EINT_BASE)
1228c2ecf20Sopenharmony_ci#define IRQ_EINT(x)		S3C_EINT(x)
1238c2ecf20Sopenharmony_ci#define IRQ_EINT_BIT(x)		((x) - S3C_EINT(0))
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
1268c2ecf20Sopenharmony_ci * that they are sourced from the GPIO pins but with a different scheme for
1278c2ecf20Sopenharmony_ci * priority and source indication.
1288c2ecf20Sopenharmony_ci *
1298c2ecf20Sopenharmony_ci * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
1308c2ecf20Sopenharmony_ci * interrupts, but for historical reasons they are kept apart from these
1318c2ecf20Sopenharmony_ci * next interrupts.
1328c2ecf20Sopenharmony_ci *
1338c2ecf20Sopenharmony_ci * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
1348c2ecf20Sopenharmony_ci * machine specific support files.
1358c2ecf20Sopenharmony_ci */
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP1_NR	(15)
1388c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP2_NR	(8)
1398c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP3_NR	(5)
1408c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP4_NR	(14)
1418c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP5_NR	(7)
1428c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP6_NR	(10)
1438c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP7_NR	(16)
1448c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP8_NR	(15)
1458c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP9_NR	(9)
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP_BASE	S3C_EINT(28)
1488c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP1_BASE	(IRQ_EINT_GROUP_BASE + 0x00)
1498c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP2_BASE	(IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
1508c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP3_BASE	(IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
1518c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP4_BASE	(IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
1528c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP5_BASE	(IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
1538c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP6_BASE	(IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
1548c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP7_BASE	(IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
1558c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP8_BASE	(IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
1568c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP9_BASE	(IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define IRQ_EINT_GROUP(group, no)	(IRQ_EINT_GROUP##group##_BASE + (no))
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* Some boards have their own IRQs behind this */
1618c2ecf20Sopenharmony_ci#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* Set the default nr_irqs, boards can override if necessary */
1648c2ecf20Sopenharmony_ci#define S3C64XX_NR_IRQS	IRQ_BOARD_START
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* Compatibility */
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define IRQ_ONENAND	IRQ_ONENAND0
1698c2ecf20Sopenharmony_ci#define IRQ_I2S0	IRQ_S3C6410_IIS
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_S3C64XX_IRQS_H */
1728c2ecf20Sopenharmony_ci
173