blob: f625d19ee42e93a70856e4e6bc96e67a4e005e92 [file] [log] [blame]
Ed Swarthout63cec582007-08-02 14:09:49 -05001/* (C) Copyright 2007 Freescale Semiconductor, Inc.
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
16 * MA 02111-1307 USA
17 *
18 */
19
Kumar Gala32049b42009-04-02 13:57:05 -050020#ifndef __FSL_PCI_H_
21#define __FSL_PCI_H_
22
Kumar Galafb3143b2009-08-03 20:44:55 -050023void fsl_pci_init(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data);
Kumar Gala32049b42009-04-02 13:57:05 -050024void fsl_pci_config_unlock(struct pci_controller *hose);
25void ft_fsl_pci_setup(void *blob, const char *pci_alias,
26 struct pci_controller *hose);
Ed Swarthout63cec582007-08-02 14:09:49 -050027
28/*
29 * Common PCI/PCIE Register structure for mpc85xx and mpc86xx
30 */
31
32/*
33 * PCI Translation Registers
34 */
35typedef struct pci_outbound_window {
36 u32 potar; /* 0x00 - Address */
37 u32 potear; /* 0x04 - Address Extended */
38 u32 powbar; /* 0x08 - Window Base Address */
39 u32 res1;
40 u32 powar; /* 0x10 - Window Attributes */
41#define POWAR_EN 0x80000000
42#define POWAR_IO_READ 0x00080000
43#define POWAR_MEM_READ 0x00040000
44#define POWAR_IO_WRITE 0x00008000
45#define POWAR_MEM_WRITE 0x00004000
46 u32 res2[3];
47} pot_t;
48
49typedef struct pci_inbound_window {
50 u32 pitar; /* 0x00 - Address */
51 u32 res1;
52 u32 piwbar; /* 0x08 - Window Base Address */
53 u32 piwbear; /* 0x0c - Window Base Address Extended */
54 u32 piwar; /* 0x10 - Window Attributes */
55#define PIWAR_EN 0x80000000
56#define PIWAR_PF 0x20000000
57#define PIWAR_LOCAL 0x00f00000
58#define PIWAR_READ_SNOOP 0x00050000
59#define PIWAR_WRITE_SNOOP 0x00005000
60 u32 res2[3];
61} pit_t;
62
63/* PCI/PCI Express Registers */
64typedef struct ccsr_pci {
65 u32 cfg_addr; /* 0x000 - PCI Configuration Address Register */
66 u32 cfg_data; /* 0x004 - PCI Configuration Data Register */
67 u32 int_ack; /* 0x008 - PCI Interrupt Acknowledge Register */
68 u32 out_comp_to; /* 0x00C - PCI Outbound Completion Timeout Register */
69 u32 out_conf_to; /* 0x010 - PCI Configuration Timeout Register */
70 u32 config; /* 0x014 - PCIE CONFIG Register */
71 char res2[8];
72 u32 pme_msg_det; /* 0x020 - PCIE PME & message detect register */
73 u32 pme_msg_dis; /* 0x024 - PCIE PME & message disable register */
74 u32 pme_msg_int_en; /* 0x028 - PCIE PME & message interrupt enable register */
75 u32 pm_command; /* 0x02c - PCIE PM Command register */
76 char res4[3016]; /* (- #xbf8 #x30)3016 */
77 u32 block_rev1; /* 0xbf8 - PCIE Block Revision register 1 */
78 u32 block_rev2; /* 0xbfc - PCIE Block Revision register 2 */
79
80 pot_t pot[5]; /* 0xc00 - 0xc9f Outbound ATMU's 0, 1, 2, 3, and 4 */
81 u32 res5[64];
82 pit_t pit[3]; /* 0xda0 - 0xdff Inbound ATMU's 3, 2, and 1 */
83#define PIT3 0
84#define PIT2 1
85#define PIT1 2
86
87#if 0
88 u32 potar0; /* 0xc00 - PCI Outbound Transaction Address Register 0 */
89 u32 potear0; /* 0xc04 - PCI Outbound Translation Extended Address Register 0 */
90 char res5[8];
91 u32 powar0; /* 0xc10 - PCI Outbound Window Attributes Register 0 */
92 char res6[12];
93 u32 potar1; /* 0xc20 - PCI Outbound Transaction Address Register 1 */
94 u32 potear1; /* 0xc24 - PCI Outbound Translation Extended Address Register 1 */
95 u32 powbar1; /* 0xc28 - PCI Outbound Window Base Address Register 1 */
96 char res7[4];
97 u32 powar1; /* 0xc30 - PCI Outbound Window Attributes Register 1 */
98 char res8[12];
99 u32 potar2; /* 0xc40 - PCI Outbound Transaction Address Register 2 */
100 u32 potear2; /* 0xc44 - PCI Outbound Translation Extended Address Register 2 */
101 u32 powbar2; /* 0xc48 - PCI Outbound Window Base Address Register 2 */
102 char res9[4];
103 u32 powar2; /* 0xc50 - PCI Outbound Window Attributes Register 2 */
104 char res10[12];
105 u32 potar3; /* 0xc60 - PCI Outbound Transaction Address Register 3 */
106 u32 potear3; /* 0xc64 - PCI Outbound Translation Extended Address Register 3 */
107 u32 powbar3; /* 0xc68 - PCI Outbound Window Base Address Register 3 */
108 char res11[4];
109 u32 powar3; /* 0xc70 - PCI Outbound Window Attributes Register 3 */
110 char res12[12];
111 u32 potar4; /* 0xc80 - PCI Outbound Transaction Address Register 4 */
112 u32 potear4; /* 0xc84 - PCI Outbound Translation Extended Address Register 4 */
113 u32 powbar4; /* 0xc88 - PCI Outbound Window Base Address Register 4 */
114 char res13[4];
115 u32 powar4; /* 0xc90 - PCI Outbound Window Attributes Register 4 */
116 char res14[268];
117 u32 pitar3; /* 0xda0 - PCI Inbound Translation Address Register 3 */
118 char res15[4];
119 u32 piwbar3; /* 0xda8 - PCI Inbound Window Base Address Register 3 */
120 u32 piwbear3; /* 0xdac - PCI Inbound Window Base Extended Address Register 3 */
121 u32 piwar3; /* 0xdb0 - PCI Inbound Window Attributes Register 3 */
122 char res16[12];
123 u32 pitar2; /* 0xdc0 - PCI Inbound Translation Address Register 2 */
124 char res17[4];
125 u32 piwbar2; /* 0xdc8 - PCI Inbound Window Base Address Register 2 */
126 u32 piwbear2; /* 0xdcc - PCI Inbound Window Base Extended Address Register 2 */
127 u32 piwar2; /* 0xdd0 - PCI Inbound Window Attributes Register 2 */
128 char res18[12];
129 u32 pitar1; /* 0xde0 - PCI Inbound Translation Address Register 1 */
130 char res19[4];
131 u32 piwbar1; /* 0xde8 - PCI Inbound Window Base Address Register 1 */
132 char res20[4];
133 u32 piwar1; /* 0xdf0 - PCI Inbound Window Attributes Register 1 */
134 char res21[12];
135#endif
136 u32 pedr; /* 0xe00 - PCI Error Detect Register */
137 u32 pecdr; /* 0xe04 - PCI Error Capture Disable Register */
138 u32 peer; /* 0xe08 - PCI Error Interrupt Enable Register */
139 u32 peattrcr; /* 0xe0c - PCI Error Attributes Capture Register */
140 u32 peaddrcr; /* 0xe10 - PCI Error Address Capture Register */
141/* u32 perr_disr * 0xe10 - PCIE Erorr Disable Register */
142 u32 peextaddrcr; /* 0xe14 - PCI Error Extended Address Capture Register */
143 u32 pedlcr; /* 0xe18 - PCI Error Data Low Capture Register */
144 u32 pedhcr; /* 0xe1c - PCI Error Error Data High Capture Register */
145 u32 gas_timr; /* 0xe20 - PCI Gasket Timer Register */
146/* u32 perr_cap_stat; * 0xe20 - PCIE Error Capture Status Register */
147 char res22[4];
148 u32 perr_cap0; /* 0xe28 - PCIE Error Capture Register 0 */
149 u32 perr_cap1; /* 0xe2c - PCIE Error Capture Register 1 */
150 u32 perr_cap2; /* 0xe30 - PCIE Error Capture Register 2 */
151 u32 perr_cap3; /* 0xe34 - PCIE Error Capture Register 3 */
Kumar Gala8ff3de62007-12-07 12:17:34 -0600152 char res23[200];
153 u32 pdb_stat; /* 0xf00 - PCIE Debug Status */
154 char res24[252];
Ed Swarthout63cec582007-08-02 14:09:49 -0500155} ccsr_fsl_pci_t;
156
Poonam Aggrwal0d3d68b2009-08-21 07:29:42 +0530157struct fsl_pci_info {
158 unsigned long regs;
159 pci_addr_t mem_bus;
160 phys_size_t mem_phys;
161 pci_size_t mem_size;
162 pci_addr_t io_bus;
163 phys_size_t io_phys;
164 pci_size_t io_size;
165 int pci_num;
166};
167
168int fsl_pci_init_port(struct fsl_pci_info *pci_info,
169 struct pci_controller *hose, int busno);
170
171#define SET_STD_PCIE_INFO(x, num) \
172{ \
173 x.regs = CONFIG_SYS_PCIE##num##_ADDR; \
174 x.mem_bus = CONFIG_SYS_PCIE##num##_MEM_BUS; \
175 x.mem_phys = CONFIG_SYS_PCIE##num##_MEM_PHYS; \
176 x.mem_size = CONFIG_SYS_PCIE##num##_MEM_SIZE; \
177 x.io_bus = CONFIG_SYS_PCIE##num##_IO_BUS; \
178 x.io_phys = CONFIG_SYS_PCIE##num##_IO_PHYS; \
179 x.io_size = CONFIG_SYS_PCIE##num##_IO_SIZE; \
180 x.pci_num = num; \
181}
182
Kumar Gala32049b42009-04-02 13:57:05 -0500183#endif