1 /*
2  * FILE NAME
3  *	include/asm-mips/vr41xx/vrc4173.h
4  *
5  * BRIEF MODULE DESCRIPTION
6  *	Include file for NEC VRC4173.
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  *
12  * Copyright (C) 2000 by Michael R. McDonald
13  *
14  * Copyright 2001-2003 Montavista Software Inc.
15  * Author: Yoichi Yuasa
16  *         yyuasa@mvista.com or source@mvista.com
17  */
18 #ifndef __NEC_VRC4173_H
19 #define __NEC_VRC4173_H
20 
21 #include <asm/io.h>
22 
23 /*
24  * Interrupt Number
25  */
26 #define VRC4173_IRQ_BASE	72
27 #define VRC4173_IRQ(x)		(VRC4173_IRQ_BASE + (x))
28 #define VRC4173_USB_IRQ		VRC4173_IRQ(0)
29 #define VRC4173_PCMCIA2_IRQ	VRC4173_IRQ(1)
30 #define VRC4173_PCMCIA1_IRQ	VRC4173_IRQ(2)
31 #define VRC4173_PS2CH2_IRQ	VRC4173_IRQ(3)
32 #define VRC4173_PS2CH1_IRQ	VRC4173_IRQ(4)
33 #define VRC4173_PIU_IRQ		VRC4173_IRQ(5)
34 #define VRC4173_AIU_IRQ		VRC4173_IRQ(6)
35 #define VRC4173_KIU_IRQ		VRC4173_IRQ(7)
36 #define VRC4173_GIU_IRQ		VRC4173_IRQ(8)
37 #define VRC4173_AC97_IRQ	VRC4173_IRQ(9)
38 #define VRC4173_AC97INT1_IRQ	VRC4173_IRQ(10)
39 /* RFU */
40 #define VRC4173_DOZEPIU_IRQ	VRC4173_IRQ(13)
41 #define VRC4173_IRQ_LAST	VRC4173_DOZEPIU_IRQ
42 
43 /*
44  * PCI I/O accesses
45  */
46 extern unsigned long vrc4173_io_offset;
47 
48 #define set_vrc4173_io_offset(offset)	do { vrc4173_io_offset = (offset); } while (0)
49 
50 #define vrc4173_outb(val,port)		outb((val), vrc4173_io_offset+(port))
51 #define vrc4173_outw(val,port)		outw((val), vrc4173_io_offset+(port))
52 #define vrc4173_outl(val,port)		outl((val), vrc4173_io_offset+(port))
53 #define vrc4173_outb_p(val,port)	outb_p((val), vrc4173_io_offset+(port))
54 #define vrc4173_outw_p(val,port)	outw_p((val), vrc4173_io_offset+(port))
55 #define vrc4173_outl_p(val,port)	outl_p((val), vrc4173_io_offset+(port))
56 
57 #define vrc4173_inb(port)		inb(vrc4173_io_offset+(port))
58 #define vrc4173_inw(port)		inw(vrc4173_io_offset+(port))
59 #define vrc4173_inl(port)		inl(vrc4173_io_offset+(port))
60 #define vrc4173_inb_p(port)		inb_p(vrc4173_io_offset+(port))
61 #define vrc4173_inw_p(port)		inw_p(vrc4173_io_offset+(port))
62 #define vrc4173_inl_p(port)		inl_p(vrc4173_io_offset+(port))
63 
64 #define vrc4173_outsb(port,addr,count)	outsb(vrc4173_io_offset+(port),(addr),(count))
65 #define vrc4173_outsw(port,addr,count)	outsw(vrc4173_io_offset+(port),(addr),(count))
66 #define vrc4173_outsl(port,addr,count)	outsl(vrc4173_io_offset+(port),(addr),(count))
67 
68 #define vrc4173_insb(port,addr,count)	insb(vrc4173_io_offset+(port),(addr),(count))
69 #define vrc4173_insw(port,addr,count)	insw(vrc4173_io_offset+(port),(addr),(count))
70 #define vrc4173_insl(port,addr,count)	insl(vrc4173_io_offset+(port),(addr),(count))
71 
72 /*
73  * Clock Mask Unit
74  */
75 enum {
76 	VRC4173_PIU_CLOCK,
77 	VRC4173_KIU_CLOCK,
78 	VRC4173_AIU_CLOCK,
79 	VRC4173_PS2_CH1_CLOCK,
80 	VRC4173_PS2_CH2_CLOCK,
81 	VRC4173_USBU_PCI_CLOCK,
82 	VRC4173_CARDU1_PCI_CLOCK,
83 	VRC4173_CARDU2_PCI_CLOCK,
84 	VRC4173_AC97U_PCI_CLOCK,
85 	VRC4173_USBU_48MHz_CLOCK,
86 	VRC4173_EXT_48MHz_CLOCK,
87 	VRC4173_48MHz_CLOCK,
88 };
89 
90 extern void vrc4173_supply_clock(unsigned int clock);
91 extern void vrc4173_mask_clock(unsigned int clock);
92 
93 /*
94  * General-Purpose I/O Unit
95  */
96 enum {
97 	PS2CH1_SELECT,
98 	PS2CH2_SELECT,
99 	TOUCHPANEL_SELECT,
100 	KIU8_SELECT,
101 	KIU10_SELECT,
102 	KIU12_SELECT,
103 	GPIO_SELECT
104 };
105 
106 extern void vrc4173_select_function(int func);
107 
108 #endif /* __NEC_VRC4173_H */
109