]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/mpl/common/pci_parts.h
Initial revision
[karo-tx-uboot.git] / board / mpl / common / pci_parts.h
1  /*
2  * (C) Copyright 2001
3  * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  *
23  */
24 #ifndef _PCI_PARTS_H_
25 #define _PCI_PARTS_H_
26
27
28 /* Board specific file containing:
29  * - PCI Memory Mapping
30  * - PCI IO Mapping
31  * - PCI Interrupt Mapping
32  */
33
34 /* PIP405 PCI INT Routing:
35  *                      IRQ0  VECTOR
36  * PIXX4 IDSEL  = AD16  INTA#  28 (Function 2 USB is INTD# = 31)
37  * VGA   IDSEL  = AD17  INTB#  29
38  * SCSI  IDSEL  = AD18  INTC#  30
39  * PC104 IDSEL0 = AD20  INTA#  28
40  * PC104 IDSEL1 = AD21  INTB#  29
41  * PC104 IDSEL2 = AD22  INTC#  30
42  * PC104 IDSEL3 = AD23  INTD#  31
43  *
44  * busdevfunc = EXXX XXXX BBBB BBBB DDDD DFFF RRRR RR00
45  *              ^         ^         ^     ^   ^
46  *             31        23        15    10   7
47  * E = Enabled
48  * B = Bussnumber
49  * D = Devicenumber (Device0 = AD10)
50  * F = Functionnumber
51  * R = Registernumber
52  *
53  * Device = (busdevfunc>>11) + 10
54  * Vector = devicenumber % 4 + 28
55  *
56  */
57 #define PCI_HIGHEST_ON_BOARD_ID 19
58 /*#define PCI_DEV_NUMBER(x)     (((x>>11) & 0x1f) + 10) */
59 #define PCI_IRQ_VECTOR(x)       ((PCI_DEV(x) + 10) % 4) + 28
60
61
62
63 /* PCI Device List for PIP405 */
64
65 /* Mapping:
66  * +-------------+------------+------------+--------------------------------+
67  * ¦ PCI MemAddr | PCI IOAddr | Local Addr | Device / Function              |
68  * +-------------+------------+------------+--------------------------------+
69  * |  0x00000000 |            | 0xA0000000 | ISA Memory (hard wired)        |
70  * |  0x00FFFFFF |            | 0xA0FFFFFF |                                |
71  * +-------------+------------+------------+--------------------------------+
72  * |             | 0x00000000 | 0xE8000000 | ISA IO (hard wired)            |
73  * |             | 0x0000FFFF | 0xE800FFFF |                                |
74  * +-------------+------------+------------+--------------------------------+
75  * |  0x80000000 |            | 0x80000000 | VGA Controller Memory          |
76  * |  0x80FFFFFF |            | 0x80FFFFFF |                                |
77  * +-------------+------------+------------+--------------------------------+
78  * |  0x81000000 |            | 0x81000000 | SCSI Controller Memory         |
79  * |  0x81FFFFFF |            | 0x81FFFFFF |                                |
80  * +-------------+------------+------------+--------------------------------+
81  */
82
83 struct pci_pip405_config_entry {
84         int             index;  /* address */
85         unsigned long   val;    /* value */
86         int             width;  /* data size */
87 };
88
89 extern void pci_pip405_write_regs(struct pci_controller *,
90                                   pci_dev_t,
91                                   struct pci_config_table *);
92
93 /* PIIX4 ISA Bridge Function 0 */
94 static struct pci_pip405_config_entry piix4_isa_bridge_f0[] = {
95         {PCI_CFG_PIIX4_SERIRQ,  0xD0,           1}, /* enable Continous SERIRQ Pin */
96         {PCI_CFG_PIIX4_GENCFG,  0x00010041,     4}, /* enable SERIRQs, ISA, PNP */
97         {PCI_CFG_PIIX4_TOM,     0xFE,           1}, /* Top of Memory            */
98         {PCI_CFG_PIIX4_XBCS,    0x02C4,         2}, /* disable all peri CS      */
99         {PCI_CFG_PIIX4_RTCCFG,  0x21,           1}, /* enable RTC               */
100 #if defined(CONFIG_PIP405)
101         {PCI_CFG_PIIX4_MBDMA,   0x82,           1}, /* set MBDMA0 to DMA 2      */
102         {PCI_CFG_PIIX4_MBDMA+1, 0x83,           1}, /* set MBDMA1 to DMA 3      */
103 #endif
104         {PCI_CFG_PIIX4_DLC,     0x0,            1}, /* disable passive release feature */
105         { }                                         /* end of device table      */
106 };
107
108 /* PIIX4 IDE Controller Function 1 */
109 static struct pci_pip405_config_entry piix4_ide_cntrl_f1[] = {
110         {PCI_COMMAND,           0x0001,         2}, /* enable IO access         */
111         {PCI_CFG_PIIX4_IDETIM,  0x80008000,     4}, /* enable Both IDE channels */
112         { }                                         /* end of device table      */
113 };
114
115 /* PIIX4 USB Controller Function 2 */
116 static struct pci_pip405_config_entry piix4_usb_cntrl_f2[] = {
117         {PCI_INTERRUPT_LINE,    31,             1}, /* Int vector = 31          */
118         {PCI_BASE_ADDRESS_4,    0x0000E001,     4}, /* Set IO Address to 0xe000 to 0xe01F */
119         {PCI_LATENCY_TIMER,     0x80,           1}, /* Latency Timer 0x80       */
120         {0xC0,                  0x2000,         2}, /* Legacy support           */
121         {PCI_COMMAND,           0x0005,         2}, /* enable IO access and Master */
122         { }                                         /* end of device table      */
123 };
124
125 /* PIIX4 Power Management Function 3 */
126 static struct pci_pip405_config_entry piix4_pmm_cntrl_f3[] = {
127         {PCI_COMMAND,           0x0001,         2}, /* enable IO access         */
128         {PCI_CFG_PIIX4_PMAB,    0x00004000,     4}, /* set PMBA to "valid" value */
129         {PCI_CFG_PIIX4_PMMISC,  0x01,           1}, /* enable PMBA IO access    */
130         {PCI_CFG_PIIX4_SMBBA,   0x00005000,     4}, /* set SMBBA to "valid" value */
131         { }                                         /* end of device table      */
132 };
133 /* PPC405 Dummy only used to prevent autosetup on this host bridge */
134 static struct pci_pip405_config_entry ibm405_dummy[] = {
135         { }                                         /* end of device table      */
136 };
137
138 void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
139                          struct pci_config_table *entry);
140
141
142 static struct pci_config_table pci_pip405_config_table[]={
143         {PCI_VENDOR_ID_IBM,                     /* 405 dummy */
144          PCI_DEVICE_ID_IBM_405GP,
145          PCI_ANY_ID,
146          PCI_ANY_ID, PCI_ANY_ID, 0,
147          pci_pip405_write_regs, {(unsigned long) ibm405_dummy}},
148
149         {PCI_VENDOR_ID_INTEL,                   /* PIIX4 ISA Bridge Function 0 */
150          PCI_DEVICE_ID_INTEL_82371AB_0,
151          PCI_ANY_ID,
152          PCI_ANY_ID, PCI_ANY_ID, 0,
153          pci_pip405_write_regs, {(unsigned long) piix4_isa_bridge_f0}},
154
155         {PCI_VENDOR_ID_INTEL,                   /* PIIX4 IDE Controller Function 1 */
156          PCI_DEVICE_ID_INTEL_82371AB,
157          PCI_ANY_ID,
158          PCI_ANY_ID, PCI_ANY_ID, 1,
159          pci_pip405_write_regs, {(unsigned long) piix4_ide_cntrl_f1}},
160
161         {PCI_VENDOR_ID_INTEL,                   /* PIIX4 USB Controller Function 2 */
162          PCI_DEVICE_ID_INTEL_82371AB_2,
163          PCI_ANY_ID,
164          PCI_ANY_ID, PCI_ANY_ID, 2,
165          pci_pip405_write_regs, {(unsigned long) piix4_usb_cntrl_f2}},
166
167         {PCI_VENDOR_ID_INTEL,                   /* PIIX4 USB Controller Function 3 */
168          PCI_DEVICE_ID_INTEL_82371AB_3,
169          PCI_ANY_ID,
170          PCI_ANY_ID, PCI_ANY_ID, 3,
171          pci_pip405_write_regs, {(unsigned long) piix4_pmm_cntrl_f3}},
172
173         {PCI_ANY_ID,
174          PCI_ANY_ID,
175          PCI_CLASS_DISPLAY_VGA,
176          PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
177          pci_405gp_setup_vga},
178
179         {PCI_ANY_ID,
180          PCI_ANY_ID,
181          PCI_CLASS_NOT_DEFINED_VGA,
182          PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
183          pci_405gp_setup_vga},
184
185         { }
186 };
187 #endif /* _PCI_PARTS_H_ */
188
189
190
191
192