blob: 75e8cae6d7fac82f66d50f73378ea59a70d70959 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001 /*
2 * (C) Copyright 2001
3 * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +00006 */
7#ifndef _PCI_PARTS_H_
8#define _PCI_PARTS_H_
9
10
11/* Board specific file containing:
12 * - PCI Memory Mapping
13 * - PCI IO Mapping
14 * - PCI Interrupt Mapping
15 */
16
17/* PIP405 PCI INT Routing:
18 * IRQ0 VECTOR
19 * PIXX4 IDSEL = AD16 INTA# 28 (Function 2 USB is INTD# = 31)
20 * VGA IDSEL = AD17 INTB# 29
21 * SCSI IDSEL = AD18 INTC# 30
22 * PC104 IDSEL0 = AD20 INTA# 28
23 * PC104 IDSEL1 = AD21 INTB# 29
24 * PC104 IDSEL2 = AD22 INTC# 30
25 * PC104 IDSEL3 = AD23 INTD# 31
26 *
27 * busdevfunc = EXXX XXXX BBBB BBBB DDDD DFFF RRRR RR00
28 * ^ ^ ^ ^ ^
29 * 31 23 15 10 7
30 * E = Enabled
31 * B = Bussnumber
32 * D = Devicenumber (Device0 = AD10)
33 * F = Functionnumber
34 * R = Registernumber
35 *
36 * Device = (busdevfunc>>11) + 10
37 * Vector = devicenumber % 4 + 28
38 *
39 */
40#define PCI_HIGHEST_ON_BOARD_ID 19
41/*#define PCI_DEV_NUMBER(x) (((x>>11) & 0x1f) + 10) */
42#define PCI_IRQ_VECTOR(x) ((PCI_DEV(x) + 10) % 4) + 28
43
44
wdenkc6097192002-11-03 00:24:07 +000045/* PCI Device List for PIP405 */
46
47/* Mapping:
48 * +-------------+------------+------------+--------------------------------+
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +020049 * | PCI MemAddr | PCI IOAddr | Local Addr | Device / Function |
wdenkc6097192002-11-03 00:24:07 +000050 * +-------------+------------+------------+--------------------------------+
51 * | 0x00000000 | | 0xA0000000 | ISA Memory (hard wired) |
52 * | 0x00FFFFFF | | 0xA0FFFFFF | |
53 * +-------------+------------+------------+--------------------------------+
54 * | | 0x00000000 | 0xE8000000 | ISA IO (hard wired) |
55 * | | 0x0000FFFF | 0xE800FFFF | |
56 * +-------------+------------+------------+--------------------------------+
57 * | 0x80000000 | | 0x80000000 | VGA Controller Memory |
58 * | 0x80FFFFFF | | 0x80FFFFFF | |
59 * +-------------+------------+------------+--------------------------------+
60 * | 0x81000000 | | 0x81000000 | SCSI Controller Memory |
61 * | 0x81FFFFFF | | 0x81FFFFFF | |
62 * +-------------+------------+------------+--------------------------------+
63 */
64
65struct pci_pip405_config_entry {
Wolfgang Denka1be4762008-05-20 16:00:29 +020066 int index; /* address */
67 unsigned long val; /* value */
68 int width; /* data size */
wdenkc6097192002-11-03 00:24:07 +000069};
70
71extern void pci_pip405_write_regs(struct pci_controller *,
72 pci_dev_t,
73 struct pci_config_table *);
74
75/* PIIX4 ISA Bridge Function 0 */
76static struct pci_pip405_config_entry piix4_isa_bridge_f0[] = {
77 {PCI_CFG_PIIX4_SERIRQ, 0xD0, 1}, /* enable Continous SERIRQ Pin */
wdenk2c9b05d2003-09-10 22:30:53 +000078 {PCI_CFG_PIIX4_GENCFG, 0x00018041, 4}, /* enable SERIRQs, ISA, PNP, GPI11 */
wdenkc6097192002-11-03 00:24:07 +000079 {PCI_CFG_PIIX4_TOM, 0xFE, 1}, /* Top of Memory */
80 {PCI_CFG_PIIX4_XBCS, 0x02C4, 2}, /* disable all peri CS */
Wolfgang Denka1be4762008-05-20 16:00:29 +020081 {PCI_CFG_PIIX4_RTCCFG, 0x21, 1}, /* enable RTC */
wdenkc6097192002-11-03 00:24:07 +000082#if defined(CONFIG_PIP405)
Wolfgang Denka1be4762008-05-20 16:00:29 +020083 {PCI_CFG_PIIX4_MBDMA, 0x82, 1}, /* set MBDMA0 to DMA 2 */
84 {PCI_CFG_PIIX4_MBDMA+1, 0x83, 1}, /* set MBDMA1 to DMA 3 */
wdenkc6097192002-11-03 00:24:07 +000085#endif
86 {PCI_CFG_PIIX4_DLC, 0x0, 1}, /* disable passive release feature */
Wolfgang Denka1be4762008-05-20 16:00:29 +020087 { } /* end of device table */
wdenkc6097192002-11-03 00:24:07 +000088};
89
90/* PIIX4 IDE Controller Function 1 */
91static struct pci_pip405_config_entry piix4_ide_cntrl_f1[] = {
wdenk2c9b05d2003-09-10 22:30:53 +000092 {PCI_CFG_PIIX4_BMIBA, 0x0001000, 4}, /* set BMI to a valid address */
Wolfgang Denka1be4762008-05-20 16:00:29 +020093 {PCI_COMMAND, 0x0001, 2}, /* enable IO access */
Tom Rini45ae6732016-09-19 21:55:34 -040094#if !defined(CONFIG_TARGET_MIP405T)
wdenkc6097192002-11-03 00:24:07 +000095 {PCI_CFG_PIIX4_IDETIM, 0x80008000, 4}, /* enable Both IDE channels */
wdenke39c2842003-06-04 15:05:30 +000096#else
wdenk874ac262003-07-24 23:38:38 +000097 {PCI_CFG_PIIX4_IDETIM, 0x00008000, 4}, /* enable IDE channel0 */
wdenke39c2842003-06-04 15:05:30 +000098#endif
Wolfgang Denka1be4762008-05-20 16:00:29 +020099 { } /* end of device table */
wdenkc6097192002-11-03 00:24:07 +0000100};
101
102/* PIIX4 USB Controller Function 2 */
103static struct pci_pip405_config_entry piix4_usb_cntrl_f2[] = {
Tom Rini45ae6732016-09-19 21:55:34 -0400104#if !defined(CONFIG_TARGET_MIP405T)
Wolfgang Denka1be4762008-05-20 16:00:29 +0200105 {PCI_INTERRUPT_LINE, 31, 1}, /* Int vector = 31 */
wdenkc6097192002-11-03 00:24:07 +0000106 {PCI_BASE_ADDRESS_4, 0x0000E001, 4}, /* Set IO Address to 0xe000 to 0xe01F */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200107 {PCI_LATENCY_TIMER, 0x80, 1}, /* Latency Timer 0x80 */
108 {0xC0, 0x2000, 2}, /* Legacy support */
wdenkc6097192002-11-03 00:24:07 +0000109 {PCI_COMMAND, 0x0005, 2}, /* enable IO access and Master */
wdenke39c2842003-06-04 15:05:30 +0000110#endif
Wolfgang Denka1be4762008-05-20 16:00:29 +0200111 { } /* end of device table */
wdenkc6097192002-11-03 00:24:07 +0000112};
113
114/* PIIX4 Power Management Function 3 */
115static struct pci_pip405_config_entry piix4_pmm_cntrl_f3[] = {
wdenk2c9b05d2003-09-10 22:30:53 +0000116 {PCI_CFG_PIIX4_PMBA, 0x00004000, 4}, /* set PMBA to "valid" value */
wdenkc6097192002-11-03 00:24:07 +0000117 {PCI_CFG_PIIX4_SMBBA, 0x00005000, 4}, /* set SMBBA to "valid" value */
wdenk2c9b05d2003-09-10 22:30:53 +0000118 {PCI_CFG_PIIX4_PMMISC, 0x01, 1}, /* enable PMBA IO access */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200119 {PCI_COMMAND, 0x0001, 2}, /* enable IO access */
120 { } /* end of device table */
wdenkc6097192002-11-03 00:24:07 +0000121};
122/* PPC405 Dummy only used to prevent autosetup on this host bridge */
Wolfgang Denk0ee70772005-09-23 11:05:55 +0200123static struct pci_pip405_config_entry ppc405_dummy[] = {
Wolfgang Denka1be4762008-05-20 16:00:29 +0200124 { } /* end of device table */
wdenkc6097192002-11-03 00:24:07 +0000125};
126
127void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
128 struct pci_config_table *entry);
129
130
131static struct pci_config_table pci_pip405_config_table[]={
Wolfgang Denka1be4762008-05-20 16:00:29 +0200132 {PCI_VENDOR_ID_IBM, /* 405 dummy */
wdenkc6097192002-11-03 00:24:07 +0000133 PCI_DEVICE_ID_IBM_405GP,
134 PCI_ANY_ID,
135 PCI_ANY_ID, PCI_ANY_ID, 0,
Wolfgang Denk0ee70772005-09-23 11:05:55 +0200136 pci_pip405_write_regs, {(unsigned long) ppc405_dummy}},
wdenkc6097192002-11-03 00:24:07 +0000137
Wolfgang Denka1be4762008-05-20 16:00:29 +0200138 {PCI_VENDOR_ID_INTEL, /* PIIX4 ISA Bridge Function 0 */
wdenkc6097192002-11-03 00:24:07 +0000139 PCI_DEVICE_ID_INTEL_82371AB_0,
140 PCI_ANY_ID,
141 PCI_ANY_ID, PCI_ANY_ID, 0,
142 pci_pip405_write_regs, {(unsigned long) piix4_isa_bridge_f0}},
143
144 {PCI_VENDOR_ID_INTEL, /* PIIX4 IDE Controller Function 1 */
145 PCI_DEVICE_ID_INTEL_82371AB,
146 PCI_ANY_ID,
147 PCI_ANY_ID, PCI_ANY_ID, 1,
148 pci_pip405_write_regs, {(unsigned long) piix4_ide_cntrl_f1}},
149
150 {PCI_VENDOR_ID_INTEL, /* PIIX4 USB Controller Function 2 */
151 PCI_DEVICE_ID_INTEL_82371AB_2,
152 PCI_ANY_ID,
153 PCI_ANY_ID, PCI_ANY_ID, 2,
154 pci_pip405_write_regs, {(unsigned long) piix4_usb_cntrl_f2}},
155
156 {PCI_VENDOR_ID_INTEL, /* PIIX4 USB Controller Function 3 */
157 PCI_DEVICE_ID_INTEL_82371AB_3,
158 PCI_ANY_ID,
159 PCI_ANY_ID, PCI_ANY_ID, 3,
160 pci_pip405_write_regs, {(unsigned long) piix4_pmm_cntrl_f3}},
161
162 {PCI_ANY_ID,
163 PCI_ANY_ID,
164 PCI_CLASS_DISPLAY_VGA,
165 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
166 pci_405gp_setup_vga},
167
168 {PCI_ANY_ID,
169 PCI_ANY_ID,
170 PCI_CLASS_NOT_DEFINED_VGA,
171 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
172 pci_405gp_setup_vga},
173
174 { }
175};
176#endif /* _PCI_PARTS_H_ */