xref: /linux/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_pci.h (revision c95baf12f5077419db01313ab61c2aac007d40cd)
1*71e2f4ddSJiaxun Yang /* SPDX-License-Identifier: GPL-2.0 */
2*71e2f4ddSJiaxun Yang /*
3*71e2f4ddSJiaxun Yang  * the definition file of cs5536 Virtual Support Module(VSM).
4*71e2f4ddSJiaxun Yang  * pci configuration space can be accessed through the VSM, so
5*71e2f4ddSJiaxun Yang  * there is no need of the MSR read/write now, except the spec.
6*71e2f4ddSJiaxun Yang  * MSR registers which are not implemented yet.
7*71e2f4ddSJiaxun Yang  *
8*71e2f4ddSJiaxun Yang  * Copyright (C) 2007 Lemote Inc.
9*71e2f4ddSJiaxun Yang  * Author : jlliu, liujl@lemote.com
10*71e2f4ddSJiaxun Yang  */
11*71e2f4ddSJiaxun Yang 
12*71e2f4ddSJiaxun Yang #ifndef _CS5536_PCI_H
13*71e2f4ddSJiaxun Yang #define _CS5536_PCI_H
14*71e2f4ddSJiaxun Yang 
15*71e2f4ddSJiaxun Yang #include <linux/types.h>
16*71e2f4ddSJiaxun Yang #include <linux/pci_regs.h>
17*71e2f4ddSJiaxun Yang 
18*71e2f4ddSJiaxun Yang extern void cs5536_pci_conf_write4(int function, int reg, u32 value);
19*71e2f4ddSJiaxun Yang extern u32 cs5536_pci_conf_read4(int function, int reg);
20*71e2f4ddSJiaxun Yang 
21*71e2f4ddSJiaxun Yang #define CS5536_ACC_INTR		9
22*71e2f4ddSJiaxun Yang #define CS5536_IDE_INTR		14
23*71e2f4ddSJiaxun Yang #define CS5536_USB_INTR		11
24*71e2f4ddSJiaxun Yang #define CS5536_MFGPT_INTR	5
25*71e2f4ddSJiaxun Yang #define CS5536_UART1_INTR	4
26*71e2f4ddSJiaxun Yang #define CS5536_UART2_INTR	3
27*71e2f4ddSJiaxun Yang 
28*71e2f4ddSJiaxun Yang /************** PCI BUS DEVICE FUNCTION ***************/
29*71e2f4ddSJiaxun Yang 
30*71e2f4ddSJiaxun Yang /*
31*71e2f4ddSJiaxun Yang  * PCI bus device function
32*71e2f4ddSJiaxun Yang  */
33*71e2f4ddSJiaxun Yang #define PCI_BUS_CS5536		0
34*71e2f4ddSJiaxun Yang #define PCI_IDSEL_CS5536	14
35*71e2f4ddSJiaxun Yang 
36*71e2f4ddSJiaxun Yang /********** STANDARD PCI-2.2 EXPANSION ****************/
37*71e2f4ddSJiaxun Yang 
38*71e2f4ddSJiaxun Yang /*
39*71e2f4ddSJiaxun Yang  * PCI configuration space
40*71e2f4ddSJiaxun Yang  * we have to virtualize the PCI configure space head, so we should
41*71e2f4ddSJiaxun Yang  * define the necessary IDs and some others.
42*71e2f4ddSJiaxun Yang  */
43*71e2f4ddSJiaxun Yang 
44*71e2f4ddSJiaxun Yang /* CONFIG of PCI VENDOR ID*/
45*71e2f4ddSJiaxun Yang #define CFG_PCI_VENDOR_ID(mod_dev_id, sys_vendor_id) \
46*71e2f4ddSJiaxun Yang 	(((mod_dev_id) << 16) | (sys_vendor_id))
47*71e2f4ddSJiaxun Yang 
48*71e2f4ddSJiaxun Yang /* VENDOR ID */
49*71e2f4ddSJiaxun Yang #define CS5536_VENDOR_ID	0x1022
50*71e2f4ddSJiaxun Yang 
51*71e2f4ddSJiaxun Yang /* DEVICE ID */
52*71e2f4ddSJiaxun Yang #define CS5536_ISA_DEVICE_ID		0x2090
53*71e2f4ddSJiaxun Yang #define CS5536_IDE_DEVICE_ID		0x209a
54*71e2f4ddSJiaxun Yang #define CS5536_ACC_DEVICE_ID		0x2093
55*71e2f4ddSJiaxun Yang #define CS5536_OHCI_DEVICE_ID		0x2094
56*71e2f4ddSJiaxun Yang #define CS5536_EHCI_DEVICE_ID		0x2095
57*71e2f4ddSJiaxun Yang 
58*71e2f4ddSJiaxun Yang /* CLASS CODE : CLASS SUB-CLASS INTERFACE */
59*71e2f4ddSJiaxun Yang #define CS5536_ISA_CLASS_CODE		0x060100
60*71e2f4ddSJiaxun Yang #define CS5536_IDE_CLASS_CODE		0x010180
61*71e2f4ddSJiaxun Yang #define CS5536_ACC_CLASS_CODE		0x040100
62*71e2f4ddSJiaxun Yang #define CS5536_OHCI_CLASS_CODE		0x0C0310
63*71e2f4ddSJiaxun Yang #define CS5536_EHCI_CLASS_CODE		0x0C0320
64*71e2f4ddSJiaxun Yang 
65*71e2f4ddSJiaxun Yang /* BHLC : BIST HEADER-TYPE LATENCY-TIMER CACHE-LINE-SIZE */
66*71e2f4ddSJiaxun Yang 
67*71e2f4ddSJiaxun Yang #define CFG_PCI_CACHE_LINE_SIZE(header_type, latency_timer)	\
68*71e2f4ddSJiaxun Yang 	((PCI_NONE_BIST << 24) | ((header_type) << 16) \
69*71e2f4ddSJiaxun Yang 		| ((latency_timer) << 8) | PCI_NORMAL_CACHE_LINE_SIZE);
70*71e2f4ddSJiaxun Yang 
71*71e2f4ddSJiaxun Yang #define PCI_NONE_BIST			0x00	/* RO not implemented yet. */
72*71e2f4ddSJiaxun Yang #define PCI_BRIDGE_HEADER_TYPE		0x80	/* RO */
73*71e2f4ddSJiaxun Yang #define PCI_NORMAL_HEADER_TYPE		0x00
74*71e2f4ddSJiaxun Yang #define PCI_NORMAL_LATENCY_TIMER	0x00
75*71e2f4ddSJiaxun Yang #define PCI_NORMAL_CACHE_LINE_SIZE	0x08	/* RW */
76*71e2f4ddSJiaxun Yang 
77*71e2f4ddSJiaxun Yang /* BAR */
78*71e2f4ddSJiaxun Yang #define PCI_BAR0_REG			0x10
79*71e2f4ddSJiaxun Yang #define PCI_BAR1_REG			0x14
80*71e2f4ddSJiaxun Yang #define PCI_BAR2_REG			0x18
81*71e2f4ddSJiaxun Yang #define PCI_BAR3_REG			0x1c
82*71e2f4ddSJiaxun Yang #define PCI_BAR4_REG			0x20
83*71e2f4ddSJiaxun Yang #define PCI_BAR5_REG			0x24
84*71e2f4ddSJiaxun Yang #define PCI_BAR_RANGE_MASK		0xFFFFFFFF
85*71e2f4ddSJiaxun Yang 
86*71e2f4ddSJiaxun Yang /* CARDBUS CIS POINTER */
87*71e2f4ddSJiaxun Yang #define PCI_CARDBUS_CIS_POINTER		0x00000000
88*71e2f4ddSJiaxun Yang 
89*71e2f4ddSJiaxun Yang /* SUBSYSTEM VENDOR ID	*/
90*71e2f4ddSJiaxun Yang #define CS5536_SUB_VENDOR_ID		CS5536_VENDOR_ID
91*71e2f4ddSJiaxun Yang 
92*71e2f4ddSJiaxun Yang /* SUBSYSTEM ID */
93*71e2f4ddSJiaxun Yang #define CS5536_ISA_SUB_ID		CS5536_ISA_DEVICE_ID
94*71e2f4ddSJiaxun Yang #define CS5536_IDE_SUB_ID		CS5536_IDE_DEVICE_ID
95*71e2f4ddSJiaxun Yang #define CS5536_ACC_SUB_ID		CS5536_ACC_DEVICE_ID
96*71e2f4ddSJiaxun Yang #define CS5536_OHCI_SUB_ID		CS5536_OHCI_DEVICE_ID
97*71e2f4ddSJiaxun Yang #define CS5536_EHCI_SUB_ID		CS5536_EHCI_DEVICE_ID
98*71e2f4ddSJiaxun Yang 
99*71e2f4ddSJiaxun Yang /* EXPANSION ROM BAR */
100*71e2f4ddSJiaxun Yang #define PCI_EXPANSION_ROM_BAR		0x00000000
101*71e2f4ddSJiaxun Yang 
102*71e2f4ddSJiaxun Yang /* CAPABILITIES POINTER */
103*71e2f4ddSJiaxun Yang #define PCI_CAPLIST_POINTER		0x00000000
104*71e2f4ddSJiaxun Yang #define PCI_CAPLIST_USB_POINTER		0x40
105*71e2f4ddSJiaxun Yang /* INTERRUPT */
106*71e2f4ddSJiaxun Yang 
107*71e2f4ddSJiaxun Yang #define CFG_PCI_INTERRUPT_LINE(pin, mod_intr) \
108*71e2f4ddSJiaxun Yang 	((PCI_MAX_LATENCY << 24) | (PCI_MIN_GRANT << 16) | \
109*71e2f4ddSJiaxun Yang 		((pin) << 8) | (mod_intr))
110*71e2f4ddSJiaxun Yang 
111*71e2f4ddSJiaxun Yang #define PCI_MAX_LATENCY			0x40
112*71e2f4ddSJiaxun Yang #define PCI_MIN_GRANT			0x00
113*71e2f4ddSJiaxun Yang #define PCI_DEFAULT_PIN			0x01
114*71e2f4ddSJiaxun Yang 
115*71e2f4ddSJiaxun Yang /*********** EXPANSION PCI REG ************************/
116*71e2f4ddSJiaxun Yang 
117*71e2f4ddSJiaxun Yang /*
118*71e2f4ddSJiaxun Yang  * ISA EXPANSION
119*71e2f4ddSJiaxun Yang  */
120*71e2f4ddSJiaxun Yang #define PCI_UART1_INT_REG	0x50
121*71e2f4ddSJiaxun Yang #define PCI_UART2_INT_REG	0x54
122*71e2f4ddSJiaxun Yang #define PCI_ISA_FIXUP_REG	0x58
123*71e2f4ddSJiaxun Yang 
124*71e2f4ddSJiaxun Yang /*
125*71e2f4ddSJiaxun Yang  * IDE EXPANSION
126*71e2f4ddSJiaxun Yang  */
127*71e2f4ddSJiaxun Yang #define PCI_IDE_CFG_REG		0x40
128*71e2f4ddSJiaxun Yang #define CS5536_IDE_FLASH_SIGNATURE	0xDEADBEEF
129*71e2f4ddSJiaxun Yang #define PCI_IDE_DTC_REG		0x48
130*71e2f4ddSJiaxun Yang #define PCI_IDE_CAST_REG	0x4C
131*71e2f4ddSJiaxun Yang #define PCI_IDE_ETC_REG		0x50
132*71e2f4ddSJiaxun Yang #define PCI_IDE_PM_REG		0x54
133*71e2f4ddSJiaxun Yang #define PCI_IDE_INT_REG		0x60
134*71e2f4ddSJiaxun Yang 
135*71e2f4ddSJiaxun Yang /*
136*71e2f4ddSJiaxun Yang  * ACC EXPANSION
137*71e2f4ddSJiaxun Yang  */
138*71e2f4ddSJiaxun Yang #define PCI_ACC_INT_REG		0x50
139*71e2f4ddSJiaxun Yang 
140*71e2f4ddSJiaxun Yang /*
141*71e2f4ddSJiaxun Yang  * OHCI EXPANSION : INTTERUPT IS IMPLEMENTED BY THE OHCI
142*71e2f4ddSJiaxun Yang  */
143*71e2f4ddSJiaxun Yang #define PCI_OHCI_PM_REG		0x40
144*71e2f4ddSJiaxun Yang #define PCI_OHCI_INT_REG	0x50
145*71e2f4ddSJiaxun Yang 
146*71e2f4ddSJiaxun Yang /*
147*71e2f4ddSJiaxun Yang  * EHCI EXPANSION
148*71e2f4ddSJiaxun Yang  */
149*71e2f4ddSJiaxun Yang #define PCI_EHCI_LEGSMIEN_REG	0x50
150*71e2f4ddSJiaxun Yang #define PCI_EHCI_LEGSMISTS_REG	0x54
151*71e2f4ddSJiaxun Yang #define PCI_EHCI_FLADJ_REG	0x60
152*71e2f4ddSJiaxun Yang 
153*71e2f4ddSJiaxun Yang #endif				/* _CS5536_PCI_H_ */
154