162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* linux/arch/arm/mach-s3c64xx/include/mach/irqs.h
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright 2008 Openmoko, Inc.
562306a36Sopenharmony_ci * Copyright 2008 Simtec Electronics
662306a36Sopenharmony_ci *      Ben Dooks <ben@simtec.co.uk>
762306a36Sopenharmony_ci *      http://armlinux.simtec.co.uk/
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * S3C64XX - IRQ support
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef __ASM_MACH_S3C64XX_IRQS_H
1362306a36Sopenharmony_ci#define __ASM_MACH_S3C64XX_IRQS_H __FILE__
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* we keep the first set of CPU IRQs out of the range of
1662306a36Sopenharmony_ci * the ISA space, so that the PC104 has them to itself
1762306a36Sopenharmony_ci * and we don't end up having to do horrible things to the
1862306a36Sopenharmony_ci * standard ISA drivers....
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * note, since we're using the VICs, our start must be a
2162306a36Sopenharmony_ci * mulitple of 32 to allow the common code to work
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define S3C_IRQ_OFFSET	(32)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define S3C_IRQ(x)	((x) + S3C_IRQ_OFFSET)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define IRQ_VIC0_BASE	S3C_IRQ(0)
2962306a36Sopenharmony_ci#define IRQ_VIC1_BASE	S3C_IRQ(32)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* VIC based IRQs */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define S3C64XX_IRQ_VIC0(x)	(IRQ_VIC0_BASE + (x))
3462306a36Sopenharmony_ci#define S3C64XX_IRQ_VIC1(x)	(IRQ_VIC1_BASE + (x))
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* VIC0 */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define IRQ_EINT0_3		S3C64XX_IRQ_VIC0(0)
3962306a36Sopenharmony_ci#define IRQ_EINT4_11		S3C64XX_IRQ_VIC0(1)
4062306a36Sopenharmony_ci#define IRQ_RTC_TIC		S3C64XX_IRQ_VIC0(2)
4162306a36Sopenharmony_ci#define IRQ_CAMIF_C		S3C64XX_IRQ_VIC0(3)
4262306a36Sopenharmony_ci#define IRQ_CAMIF_P		S3C64XX_IRQ_VIC0(4)
4362306a36Sopenharmony_ci#define IRQ_CAMIF_MC		S3C64XX_IRQ_VIC0(5)
4462306a36Sopenharmony_ci#define IRQ_S3C6410_IIC1	S3C64XX_IRQ_VIC0(5)
4562306a36Sopenharmony_ci#define IRQ_S3C6410_IIS		S3C64XX_IRQ_VIC0(6)
4662306a36Sopenharmony_ci#define IRQ_S3C6400_CAMIF_MP	S3C64XX_IRQ_VIC0(6)
4762306a36Sopenharmony_ci#define IRQ_CAMIF_WE_C		S3C64XX_IRQ_VIC0(7)
4862306a36Sopenharmony_ci#define IRQ_S3C6410_G3D		S3C64XX_IRQ_VIC0(8)
4962306a36Sopenharmony_ci#define IRQ_S3C6400_CAMIF_WE_P	S3C64XX_IRQ_VIC0(8)
5062306a36Sopenharmony_ci#define IRQ_POST0		S3C64XX_IRQ_VIC0(9)
5162306a36Sopenharmony_ci#define IRQ_ROTATOR		S3C64XX_IRQ_VIC0(10)
5262306a36Sopenharmony_ci#define IRQ_2D			S3C64XX_IRQ_VIC0(11)
5362306a36Sopenharmony_ci#define IRQ_TVENC		S3C64XX_IRQ_VIC0(12)
5462306a36Sopenharmony_ci#define IRQ_SCALER		S3C64XX_IRQ_VIC0(13)
5562306a36Sopenharmony_ci#define IRQ_BATF		S3C64XX_IRQ_VIC0(14)
5662306a36Sopenharmony_ci#define IRQ_JPEG		S3C64XX_IRQ_VIC0(15)
5762306a36Sopenharmony_ci#define IRQ_MFC			S3C64XX_IRQ_VIC0(16)
5862306a36Sopenharmony_ci#define IRQ_SDMA0		S3C64XX_IRQ_VIC0(17)
5962306a36Sopenharmony_ci#define IRQ_SDMA1		S3C64XX_IRQ_VIC0(18)
6062306a36Sopenharmony_ci#define IRQ_ARM_DMAERR		S3C64XX_IRQ_VIC0(19)
6162306a36Sopenharmony_ci#define IRQ_ARM_DMA		S3C64XX_IRQ_VIC0(20)
6262306a36Sopenharmony_ci#define IRQ_ARM_DMAS		S3C64XX_IRQ_VIC0(21)
6362306a36Sopenharmony_ci#define IRQ_KEYPAD		S3C64XX_IRQ_VIC0(22)
6462306a36Sopenharmony_ci#define IRQ_TIMER0_VIC		S3C64XX_IRQ_VIC0(23)
6562306a36Sopenharmony_ci#define IRQ_TIMER1_VIC		S3C64XX_IRQ_VIC0(24)
6662306a36Sopenharmony_ci#define IRQ_TIMER2_VIC		S3C64XX_IRQ_VIC0(25)
6762306a36Sopenharmony_ci#define IRQ_WDT			S3C64XX_IRQ_VIC0(26)
6862306a36Sopenharmony_ci#define IRQ_TIMER3_VIC		S3C64XX_IRQ_VIC0(27)
6962306a36Sopenharmony_ci#define IRQ_TIMER4_VIC		S3C64XX_IRQ_VIC0(28)
7062306a36Sopenharmony_ci#define IRQ_LCD_FIFO		S3C64XX_IRQ_VIC0(29)
7162306a36Sopenharmony_ci#define IRQ_LCD_VSYNC		S3C64XX_IRQ_VIC0(30)
7262306a36Sopenharmony_ci#define IRQ_LCD_SYSTEM		S3C64XX_IRQ_VIC0(31)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* VIC1 */
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define IRQ_EINT12_19		S3C64XX_IRQ_VIC1(0)
7762306a36Sopenharmony_ci#define IRQ_EINT20_27		S3C64XX_IRQ_VIC1(1)
7862306a36Sopenharmony_ci#define IRQ_PCM0		S3C64XX_IRQ_VIC1(2)
7962306a36Sopenharmony_ci#define IRQ_PCM1		S3C64XX_IRQ_VIC1(3)
8062306a36Sopenharmony_ci#define IRQ_AC97		S3C64XX_IRQ_VIC1(4)
8162306a36Sopenharmony_ci#define IRQ_UART0		S3C64XX_IRQ_VIC1(5)
8262306a36Sopenharmony_ci#define IRQ_UART1		S3C64XX_IRQ_VIC1(6)
8362306a36Sopenharmony_ci#define IRQ_UART2		S3C64XX_IRQ_VIC1(7)
8462306a36Sopenharmony_ci#define IRQ_UART3		S3C64XX_IRQ_VIC1(8)
8562306a36Sopenharmony_ci#define IRQ_DMA0		S3C64XX_IRQ_VIC1(9)
8662306a36Sopenharmony_ci#define IRQ_DMA1		S3C64XX_IRQ_VIC1(10)
8762306a36Sopenharmony_ci#define IRQ_ONENAND0		S3C64XX_IRQ_VIC1(11)
8862306a36Sopenharmony_ci#define IRQ_ONENAND1		S3C64XX_IRQ_VIC1(12)
8962306a36Sopenharmony_ci#define IRQ_NFC			S3C64XX_IRQ_VIC1(13)
9062306a36Sopenharmony_ci#define IRQ_CFCON		S3C64XX_IRQ_VIC1(14)
9162306a36Sopenharmony_ci#define IRQ_USBH		S3C64XX_IRQ_VIC1(15)
9262306a36Sopenharmony_ci#define IRQ_SPI0		S3C64XX_IRQ_VIC1(16)
9362306a36Sopenharmony_ci#define IRQ_SPI1		S3C64XX_IRQ_VIC1(17)
9462306a36Sopenharmony_ci#define IRQ_IIC			S3C64XX_IRQ_VIC1(18)
9562306a36Sopenharmony_ci#define IRQ_HSItx		S3C64XX_IRQ_VIC1(19)
9662306a36Sopenharmony_ci#define IRQ_HSIrx		S3C64XX_IRQ_VIC1(20)
9762306a36Sopenharmony_ci#define IRQ_RESERVED		S3C64XX_IRQ_VIC1(21)
9862306a36Sopenharmony_ci#define IRQ_MSM			S3C64XX_IRQ_VIC1(22)
9962306a36Sopenharmony_ci#define IRQ_HOSTIF		S3C64XX_IRQ_VIC1(23)
10062306a36Sopenharmony_ci#define IRQ_HSMMC0		S3C64XX_IRQ_VIC1(24)
10162306a36Sopenharmony_ci#define IRQ_HSMMC1		S3C64XX_IRQ_VIC1(25)
10262306a36Sopenharmony_ci#define IRQ_HSMMC2		IRQ_SPI1	/* shared with SPI1 */
10362306a36Sopenharmony_ci#define IRQ_OTG			S3C64XX_IRQ_VIC1(26)
10462306a36Sopenharmony_ci#define IRQ_IRDA		S3C64XX_IRQ_VIC1(27)
10562306a36Sopenharmony_ci#define IRQ_RTC_ALARM		S3C64XX_IRQ_VIC1(28)
10662306a36Sopenharmony_ci#define IRQ_SEC			S3C64XX_IRQ_VIC1(29)
10762306a36Sopenharmony_ci#define IRQ_PENDN		S3C64XX_IRQ_VIC1(30)
10862306a36Sopenharmony_ci#define IRQ_TC			IRQ_PENDN
10962306a36Sopenharmony_ci#define IRQ_ADC			S3C64XX_IRQ_VIC1(31)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* compatibility for device defines */
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#define IRQ_IIC1		IRQ_S3C6410_IIC1
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
11662306a36Sopenharmony_ci * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
11762306a36Sopenharmony_ci * which we place after the pair of VICs. */
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#define S3C_IRQ_EINT_BASE	S3C_IRQ(64+5)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define S3C_EINT(x)		((x) + S3C_IRQ_EINT_BASE)
12262306a36Sopenharmony_ci#define IRQ_EINT(x)		S3C_EINT(x)
12362306a36Sopenharmony_ci#define IRQ_EINT_BIT(x)		((x) - S3C_EINT(0))
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
12662306a36Sopenharmony_ci * that they are sourced from the GPIO pins but with a different scheme for
12762306a36Sopenharmony_ci * priority and source indication.
12862306a36Sopenharmony_ci *
12962306a36Sopenharmony_ci * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
13062306a36Sopenharmony_ci * interrupts, but for historical reasons they are kept apart from these
13162306a36Sopenharmony_ci * next interrupts.
13262306a36Sopenharmony_ci *
13362306a36Sopenharmony_ci * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
13462306a36Sopenharmony_ci * machine specific support files.
13562306a36Sopenharmony_ci */
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci#define IRQ_EINT_GROUP1_NR	(15)
13862306a36Sopenharmony_ci#define IRQ_EINT_GROUP2_NR	(8)
13962306a36Sopenharmony_ci#define IRQ_EINT_GROUP3_NR	(5)
14062306a36Sopenharmony_ci#define IRQ_EINT_GROUP4_NR	(14)
14162306a36Sopenharmony_ci#define IRQ_EINT_GROUP5_NR	(7)
14262306a36Sopenharmony_ci#define IRQ_EINT_GROUP6_NR	(10)
14362306a36Sopenharmony_ci#define IRQ_EINT_GROUP7_NR	(16)
14462306a36Sopenharmony_ci#define IRQ_EINT_GROUP8_NR	(15)
14562306a36Sopenharmony_ci#define IRQ_EINT_GROUP9_NR	(9)
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define IRQ_EINT_GROUP_BASE	S3C_EINT(28)
14862306a36Sopenharmony_ci#define IRQ_EINT_GROUP1_BASE	(IRQ_EINT_GROUP_BASE + 0x00)
14962306a36Sopenharmony_ci#define IRQ_EINT_GROUP2_BASE	(IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
15062306a36Sopenharmony_ci#define IRQ_EINT_GROUP3_BASE	(IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
15162306a36Sopenharmony_ci#define IRQ_EINT_GROUP4_BASE	(IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
15262306a36Sopenharmony_ci#define IRQ_EINT_GROUP5_BASE	(IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
15362306a36Sopenharmony_ci#define IRQ_EINT_GROUP6_BASE	(IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
15462306a36Sopenharmony_ci#define IRQ_EINT_GROUP7_BASE	(IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
15562306a36Sopenharmony_ci#define IRQ_EINT_GROUP8_BASE	(IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
15662306a36Sopenharmony_ci#define IRQ_EINT_GROUP9_BASE	(IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define IRQ_EINT_GROUP(group, no)	(IRQ_EINT_GROUP##group##_BASE + (no))
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* Some boards have their own IRQs behind this */
16162306a36Sopenharmony_ci#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/* Set the default nr_irqs, boards can override if necessary */
16462306a36Sopenharmony_ci#define S3C64XX_NR_IRQS	IRQ_BOARD_START
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci/* Compatibility */
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define IRQ_ONENAND	IRQ_ONENAND0
16962306a36Sopenharmony_ci#define IRQ_I2S0	IRQ_S3C6410_IIS
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#endif /* __ASM_MACH_S3C64XX_IRQS_H */
17262306a36Sopenharmony_ci
173