18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/****************************************************************************/
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci *	mcfintc.h -- support definitions for the simple ColdFire
68c2ecf20Sopenharmony_ci *		     Interrupt Controller
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * 	(C) Copyright 2009,  Greg Ungerer <gerg@uclinux.org>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/****************************************************************************/
128c2ecf20Sopenharmony_ci#ifndef	mcfintc_h
138c2ecf20Sopenharmony_ci#define	mcfintc_h
148c2ecf20Sopenharmony_ci/****************************************************************************/
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Most of the older ColdFire parts use the same simple interrupt
188c2ecf20Sopenharmony_ci * controller. This is currently used on the 5206, 5206e, 5249, 5307
198c2ecf20Sopenharmony_ci * and 5407 parts.
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * The builtin peripherals are masked through dedicated bits in the
228c2ecf20Sopenharmony_ci * Interrupt Mask register (IMR) - and this is not indexed (or in any way
238c2ecf20Sopenharmony_ci * related to) the actual interrupt number they use. So knowing the IRQ
248c2ecf20Sopenharmony_ci * number doesn't explicitly map to a certain internal device for
258c2ecf20Sopenharmony_ci * interrupt control purposes.
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*
298c2ecf20Sopenharmony_ci * Bit definitions for the ICR family of registers.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_AUTOVEC	0x80		/* Auto-vectored intr */
328c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL0	0x00		/* Level 0 intr */
338c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL1	0x04		/* Level 1 intr */
348c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL2	0x08		/* Level 2 intr */
358c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL3	0x0c		/* Level 3 intr */
368c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL4	0x10		/* Level 4 intr */
378c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL5	0x14		/* Level 5 intr */
388c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL6	0x18		/* Level 6 intr */
398c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_LEVEL7	0x1c		/* Level 7 intr */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_PRI0		0x00		/* Priority 0 intr */
428c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_PRI1		0x01		/* Priority 1 intr */
438c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_PRI2		0x02		/* Priority 2 intr */
448c2ecf20Sopenharmony_ci#define	MCFSIM_ICR_PRI3		0x03		/* Priority 3 intr */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*
478c2ecf20Sopenharmony_ci * IMR bit position definitions. Not all ColdFire parts with this interrupt
488c2ecf20Sopenharmony_ci * controller actually support all of these interrupt sources. But the bit
498c2ecf20Sopenharmony_ci * numbers are the same in all cores.
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci#define	MCFINTC_EINT1		1		/* External int #1 */
528c2ecf20Sopenharmony_ci#define	MCFINTC_EINT2		2		/* External int #2 */
538c2ecf20Sopenharmony_ci#define	MCFINTC_EINT3		3		/* External int #3 */
548c2ecf20Sopenharmony_ci#define	MCFINTC_EINT4		4		/* External int #4 */
558c2ecf20Sopenharmony_ci#define	MCFINTC_EINT5		5		/* External int #5 */
568c2ecf20Sopenharmony_ci#define	MCFINTC_EINT6		6		/* External int #6 */
578c2ecf20Sopenharmony_ci#define	MCFINTC_EINT7		7		/* External int #7 */
588c2ecf20Sopenharmony_ci#define	MCFINTC_SWT		8		/* Software Watchdog */
598c2ecf20Sopenharmony_ci#define	MCFINTC_TIMER1		9
608c2ecf20Sopenharmony_ci#define	MCFINTC_TIMER2		10
618c2ecf20Sopenharmony_ci#define	MCFINTC_I2C		11		/* I2C / MBUS */
628c2ecf20Sopenharmony_ci#define	MCFINTC_UART0		12
638c2ecf20Sopenharmony_ci#define	MCFINTC_UART1		13
648c2ecf20Sopenharmony_ci#define	MCFINTC_DMA0		14
658c2ecf20Sopenharmony_ci#define	MCFINTC_DMA1		15
668c2ecf20Sopenharmony_ci#define	MCFINTC_DMA2		16
678c2ecf20Sopenharmony_ci#define	MCFINTC_DMA3		17
688c2ecf20Sopenharmony_ci#define	MCFINTC_QSPI		18
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#ifndef __ASSEMBLER__
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/*
738c2ecf20Sopenharmony_ci * There is no one-is-one correspondance between the interrupt number (irq)
748c2ecf20Sopenharmony_ci * and the bit fields on the mask register. So we create a per-cpu type
758c2ecf20Sopenharmony_ci * mapping of irq to mask bit. The CPU platform code needs to register
768c2ecf20Sopenharmony_ci * its supported irq's at init time, using this function.
778c2ecf20Sopenharmony_ci */
788c2ecf20Sopenharmony_ciextern unsigned char mcf_irq2imr[];
798c2ecf20Sopenharmony_cistatic inline void mcf_mapirq2imr(int irq, int imr)
808c2ecf20Sopenharmony_ci{
818c2ecf20Sopenharmony_ci	mcf_irq2imr[irq] = imr;
828c2ecf20Sopenharmony_ci}
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_civoid mcf_autovector(int irq);
858c2ecf20Sopenharmony_civoid mcf_setimr(int index);
868c2ecf20Sopenharmony_civoid mcf_clrimr(int index);
878c2ecf20Sopenharmony_ci#endif
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/****************************************************************************/
908c2ecf20Sopenharmony_ci#endif	/* mcfintc_h */
91