16a0abce4SKuninori Morimoto /* SPDX-License-Identifier: GPL-2.0
26a0abce4SKuninori Morimoto  *
37639a454SPaul Mundt  * linux/include/asm-sh/microdev.h
47639a454SPaul Mundt  *
57639a454SPaul Mundt  * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com)
67639a454SPaul Mundt  *
77639a454SPaul Mundt  * Definitions for the SuperH SH4-202 MicroDev board.
87639a454SPaul Mundt  */
97639a454SPaul Mundt #ifndef __ASM_SH_MICRODEV_H
107639a454SPaul Mundt #define __ASM_SH_MICRODEV_H
117639a454SPaul Mundt 
127639a454SPaul Mundt extern void init_microdev_irq(void);
137639a454SPaul Mundt extern void microdev_print_fpga_intc_status(void);
147639a454SPaul Mundt 
157639a454SPaul Mundt /*
167639a454SPaul Mundt  * The following are useful macros for manipulating the interrupt
177639a454SPaul Mundt  * controller (INTC) on the CPU-board FPGA.  should be noted that there
187639a454SPaul Mundt  * is an INTC on the FPGA, and a separate INTC on the SH4-202 core -
197639a454SPaul Mundt  * these are two different things, both of which need to be prorammed to
207639a454SPaul Mundt  * correctly route - unfortunately, they have the same name and
217639a454SPaul Mundt  * abbreviations!
227639a454SPaul Mundt  */
237639a454SPaul Mundt #define	MICRODEV_FPGA_INTC_BASE		0xa6110000ul				/* INTC base address on CPU-board FPGA */
247639a454SPaul Mundt #define	MICRODEV_FPGA_INTENB_REG	(MICRODEV_FPGA_INTC_BASE+0ul)		/* Interrupt Enable Register on INTC on CPU-board FPGA */
257639a454SPaul Mundt #define	MICRODEV_FPGA_INTDSB_REG	(MICRODEV_FPGA_INTC_BASE+8ul)		/* Interrupt Disable Register on INTC on CPU-board FPGA */
267639a454SPaul Mundt #define	MICRODEV_FPGA_INTC_MASK(n)	(1ul<<(n))				/* Interrupt mask to enable/disable INTC in CPU-board FPGA */
277639a454SPaul Mundt #define	MICRODEV_FPGA_INTPRI_REG(n)	(MICRODEV_FPGA_INTC_BASE+0x10+((n)/8)*8)/* Interrupt Priority Register on INTC on CPU-board FPGA */
287639a454SPaul Mundt #define	MICRODEV_FPGA_INTPRI_LEVEL(n,x)	((x)<<(((n)%8)*4))			/* MICRODEV_FPGA_INTPRI_LEVEL(int_number, int_level) */
297639a454SPaul Mundt #define	MICRODEV_FPGA_INTPRI_MASK(n)	(MICRODEV_FPGA_INTPRI_LEVEL((n),0xful))	/* Interrupt Priority Mask on INTC on CPU-board FPGA */
307639a454SPaul Mundt #define	MICRODEV_FPGA_INTSRC_REG	(MICRODEV_FPGA_INTC_BASE+0x30ul)	/* Interrupt Source Register on INTC on CPU-board FPGA */
317639a454SPaul Mundt #define	MICRODEV_FPGA_INTREQ_REG	(MICRODEV_FPGA_INTC_BASE+0x38ul)	/* Interrupt Request Register on INTC on CPU-board FPGA */
327639a454SPaul Mundt 
337639a454SPaul Mundt 
347639a454SPaul Mundt /*
357639a454SPaul Mundt  * The following are the IRQ numbers for the Linux Kernel for external
367639a454SPaul Mundt  * interrupts.  i.e. the numbers seen by 'cat /proc/interrupt'.
377639a454SPaul Mundt  */
387639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_KEYBOARD	 1	/* SuperIO Keyboard */
397639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_SERIAL1	 2	/* SuperIO Serial #1 */
407639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_ETHERNET	 3	/* on-board Ethnernet */
417639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_SERIAL2	 4	/* SuperIO Serial #2 */
427639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_USB_HC	 7	/* on-board USB HC */
437639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_MOUSE	12	/* SuperIO PS/2 Mouse */
447639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_IDE2		13	/* SuperIO IDE #2 */
457639a454SPaul Mundt #define MICRODEV_LINUX_IRQ_IDE1		14	/* SuperIO IDE #1 */
467639a454SPaul Mundt 
477639a454SPaul Mundt /*
487639a454SPaul Mundt  * The following are the IRQ numbers for the INTC on the FPGA for
497639a454SPaul Mundt  * external interrupts.  i.e. the bits in the INTC registers in the
507639a454SPaul Mundt  * FPGA.
517639a454SPaul Mundt  */
527639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_KEYBOARD	 1	/* SuperIO Keyboard */
537639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_SERIAL1	 3	/* SuperIO Serial #1 */
547639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_SERIAL2	 4	/* SuperIO Serial #2 */
557639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_MOUSE		12	/* SuperIO PS/2 Mouse */
567639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_IDE1		14	/* SuperIO IDE #1 */
577639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_IDE2		15	/* SuperIO IDE #2 */
587639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_USB_HC	16	/* on-board USB HC */
597639a454SPaul Mundt #define MICRODEV_FPGA_IRQ_ETHERNET	18	/* on-board Ethnernet */
607639a454SPaul Mundt 
617639a454SPaul Mundt #define MICRODEV_IRQ_PCI_INTA		 8
627639a454SPaul Mundt #define MICRODEV_IRQ_PCI_INTB		 9
637639a454SPaul Mundt #define MICRODEV_IRQ_PCI_INTC		10
647639a454SPaul Mundt #define MICRODEV_IRQ_PCI_INTD		11
657639a454SPaul Mundt 
667639a454SPaul Mundt #define __IO_PREFIX microdev
677639a454SPaul Mundt #include <asm/io_generic.h>
687639a454SPaul Mundt 
697639a454SPaul Mundt #endif /* __ASM_SH_MICRODEV_H */
70