0fd40196335943697414de4dd7306c17b174ce5a
[platform/kernel/u-boot.git] / arch / powerpc / include / asm / ppc440ep_gr.h
1 /*
2  * (C) Copyright 2010
3  * Stefan Roese, DENX Software Engineering, sr@denx.de.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA
19  */
20
21 #ifndef _PPC440EP_GR_H_
22 #define _PPC440EP_GR_H_
23
24 #define CONFIG_SDRAM_PPC4xx_IBM_DDR     /* IBM DDR controller */
25
26 #define CONFIG_NAND_NDFC
27
28 /*
29  * Some SoC specific registers (not common for all 440 SoC's)
30  */
31 #define GPIO0_BASE      (CONFIG_SYS_PERIPHERAL_BASE + 0x00000B00)
32 #define GPIO1_BASE      (CONFIG_SYS_PERIPHERAL_BASE + 0x00000C00)
33
34 #define SDR0_PCI0       0x0300
35 #define SDR0_SDSTP2     0x4001
36 #define SDR0_SDSTP3     0x4003
37
38 #define SDR0_SDSTP1_PAE_MASK            (0x80000000 >> 21)
39 #define SDR0_SDSTP1_PAME_MASK           (0x80000000 >> 27)
40
41 /* Pin Function Control Register 1 */
42 #define SDR0_PFC1_U1ME_MASK             0x02000000 /* UART1 Mode Enable */
43 #define SDR0_PFC1_U1ME_DSR_DTR          0x00000000 /* UART1 in DSR/DTR Mode */
44 #define SDR0_PFC1_U1ME_CTS_RTS          0x02000000 /* UART1 in CTS/RTS Mode */
45 #define SDR0_PFC1_U0ME_MASK             0x00080000 /* UART0 Mode Enable */
46 #define SDR0_PFC1_U0ME_DSR_DTR          0x00000000 /* UART0 in DSR/DTR Mode */
47 #define SDR0_PFC1_U0ME_CTS_RTS          0x00080000 /* UART0 in CTS/RTS Mode */
48 #define SDR0_PFC1_U0IM_MASK             0x00040000 /* UART0 Interface Mode */
49 #define SDR0_PFC1_U0IM_8PINS            0x00000000 /* UART0 Interface Mode 8 pins */
50 #define SDR0_PFC1_U0IM_4PINS            0x00040000 /* UART0 Interface Mode 4 pins */
51 #define SDR0_PFC1_SIS_MASK              0x00020000 /* SCP or IIC1 Selection */
52 #define SDR0_PFC1_SIS_SCP_SEL           0x00000000 /* SCP Selected */
53 #define SDR0_PFC1_SIS_IIC1_SEL          0x00020000 /* IIC1 Selected */
54 #define SDR0_PFC1_UES_MASK              0x00010000 /* USB2D_RX_Active / EBC_Hold
55                                                       Req Selection */
56 #define SDR0_PFC1_UES_USB2D_SEL         0x00000000 /* USB2D_RX_Active Selected */
57 #define SDR0_PFC1_UES_EBCHR_SEL         0x00010000 /* EBC_Hold Req Selected */
58 #define SDR0_PFC1_DIS_MASK              0x00008000 /* DMA_Req(1) / UIC_IRQ(5)
59                                                       Selection */
60 #define SDR0_PFC1_DIS_DMAR_SEL          0x00000000 /* DMA_Req(1) Selected */
61 #define SDR0_PFC1_DIS_UICIRQ5_SEL       0x00008000 /* UIC_IRQ(5) Selected */
62 #define SDR0_PFC1_ERE_MASK              0x00004000 /* EBC Mast.Ext.Req.En./GPIO0(27)
63                                                       Selection */
64 #define SDR0_PFC1_ERE_EXTR_SEL          0x00000000 /* EBC Mast.Ext.Req.En.
65                                                       Selected */
66 #define SDR0_PFC1_ERE_GPIO0_27_SEL      0x00004000 /* GPIO0(27) Selected */
67 #define SDR0_PFC1_UPR_MASK              0x00002000 /* USB2 Device Packet Reject
68                                                       Selection */
69 #define SDR0_PFC1_UPR_DISABLE           0x00000000 /* USB2 Device Packet Reject
70                                                       Disable */
71 #define SDR0_PFC1_UPR_ENABLE            0x00002000 /* USB2 Device Packet Reject
72                                                       Enable */
73 #define SDR0_PFC1_PLB_PME_MASK          0x00001000 /* PLB3/PLB4 Perf. Monitor Enable
74                                                       Selection */
75 #define SDR0_PFC1_PLB_PME_PLB3_SEL      0x00000000 /* PLB3 Performance Monitor
76                                                       Enable */
77 #define SDR0_PFC1_PLB_PME_PLB4_SEL      0x00001000 /* PLB3 Performance Monitor
78                                                       Enable */
79 #define SDR0_PFC1_GFGGI_MASK            0x0000000F /* GPT Frequency Generation
80                                                       Gated In */
81
82 /* USB Control Register */
83 #define SDR0_USB0_USB_DEVSEL_MASK       0x00000002 /* USB Device Selection */
84 #define SDR0_USB0_USB20D_DEVSEL         0x00000000 /* USB2.0 Device Selected */
85 #define SDR0_USB0_USB11D_DEVSEL         0x00000002 /* USB1.1 Device Selected */
86 #define SDR0_USB0_LEEN_MASK             0x00000001 /* Little Endian selection */
87 #define SDR0_USB0_LEEN_DISABLE          0x00000000 /* Little Endian Disable */
88 #define SDR0_USB0_LEEN_ENABLE           0x00000001 /* Little Endian Enable */
89
90 /* Miscealleneaous Function Reg. */
91 #define SDR0_MFR_ETH0_CLK_SEL_MASK      0x08000000 /* Ethernet0 Clock Select */
92 #define SDR0_MFR_ETH0_CLK_SEL_EXT       0x00000000
93 #define SDR0_MFR_ETH1_CLK_SEL_MASK      0x04000000 /* Ethernet1 Clock Select */
94 #define SDR0_MFR_ETH1_CLK_SEL_EXT       0x00000000
95 #define SDR0_MFR_ZMII_MODE_MASK         0x03000000 /* ZMII Mode Mask */
96 #define SDR0_MFR_ZMII_MODE_MII          0x00000000 /* ZMII Mode MII */
97 #define SDR0_MFR_ZMII_MODE_SMII         0x01000000 /* ZMII Mode SMII */
98 #define SDR0_MFR_ZMII_MODE_RMII_10M     0x02000000 /* ZMII Mode RMII - 10 Mbs */
99 #define SDR0_MFR_ZMII_MODE_RMII_100M    0x03000000 /* ZMII Mode RMII - 100 Mbs */
100 #define SDR0_MFR_ZMII_MODE_BIT0         0x02000000 /* ZMII Mode Bit0 */
101 #define SDR0_MFR_ZMII_MODE_BIT1         0x01000000 /* ZMII Mode Bit1 */
102 #define SDR0_MFR_ZM_ENCODE(n)           ((((u32)(n)) & 0x3) << 24)
103 #define SDR0_MFR_ZM_DECODE(n)           ((((u32)(n)) << 24) & 0x3)
104
105 #define SDR0_MFR_ERRATA3_EN0            0x00800000
106 #define SDR0_MFR_ERRATA3_EN1            0x00400000
107 #define SDR0_MFR_PKT_REJ_MASK           0x00180000 /* Pkt Rej. Enable Mask */
108 #define SDR0_MFR_PKT_REJ_EN             0x00180000 /* Pkt Rej. Ena. on both EMAC3 0-1 */
109 #define SDR0_MFR_PKT_REJ_EN0            0x00100000 /* Pkt Rej. Enable on EMAC3(0) */
110 #define SDR0_MFR_PKT_REJ_EN1            0x00080000 /* Pkt Rej. Enable on EMAC3(1) */
111 #define SDR0_MFR_PKT_REJ_POL            0x00200000 /* Packet Reject Polarity */
112
113 /* CUST0 Customer Configuration Register0 */
114 #define SDR0_CUST0_MUX_E_N_G_MASK       0xC0000000 /* Mux_Emac_NDFC_GPIO */
115 #define SDR0_CUST0_MUX_EMAC_SEL         0x40000000 /* Emac Selection */
116 #define SDR0_CUST0_MUX_NDFC_SEL         0x80000000 /* NDFC Selection */
117 #define SDR0_CUST0_MUX_GPIO_SEL         0xC0000000 /* GPIO Selection */
118
119 #define SDR0_CUST0_NDFC_EN_MASK         0x20000000 /* NDFC Enable Mask */
120 #define SDR0_CUST0_NDFC_ENABLE          0x20000000 /* NDFC Enable */
121 #define SDR0_CUST0_NDFC_DISABLE         0x00000000 /* NDFC Disable */
122
123 #define SDR0_CUST0_NDFC_BW_MASK         0x10000000 /* NDFC Boot Width */
124 #define SDR0_CUST0_NDFC_BW_16_BIT       0x10000000 /* NDFC Boot Width = 16 Bit */
125 #define SDR0_CUST0_NDFC_BW_8_BIT        0x00000000 /* NDFC Boot Width =  8 Bit */
126
127 #define SDR0_CUST0_NDFC_BP_MASK         0x0F000000 /* NDFC Boot Page */
128 #define SDR0_CUST0_NDFC_BP_ENCODE(n)    ((((u32)(n)) & 0xF) << 24)
129 #define SDR0_CUST0_NDFC_BP_DECODE(n)    ((((u32)(n)) >> 24) & 0xF)
130
131 #define SDR0_CUST0_NDFC_BAC_MASK        0x00C00000 /* NDFC Boot Address Cycle */
132 #define SDR0_CUST0_NDFC_BAC_ENCODE(n)   ((((u32)(n)) & 0x3) << 22)
133 #define SDR0_CUST0_NDFC_BAC_DECODE(n)   ((((u32)(n)) >> 22) & 0x3)
134
135 #define SDR0_CUST0_NDFC_ARE_MASK        0x00200000 /* NDFC Auto Read Enable */
136 #define SDR0_CUST0_NDFC_ARE_ENABLE      0x00200000 /* NDFC Auto Read Enable */
137 #define SDR0_CUST0_NDFC_ARE_DISABLE     0x00000000 /* NDFC Auto Read Disable */
138
139 #define SDR0_CUST0_NRB_MASK             0x00100000 /* NDFC Ready / Busy */
140 #define SDR0_CUST0_NRB_BUSY             0x00100000 /* Busy */
141 #define SDR0_CUST0_NRB_READY            0x00000000 /* Ready */
142
143 #define SDR0_CUST0_NDRSC_MASK           0x0000FFF0 /* NDFC Device Reset Count Mask */
144 #define SDR0_CUST0_NDRSC_ENCODE(n)      ((((u32)(n)) & 0xFFF) << 4)
145 #define SDR0_CUST0_NDRSC_DECODE(n)      ((((u32)(n)) >> 4) & 0xFFF)
146
147 #define SDR0_CUST0_CHIPSELGAT_MASK      0x0000000F /* Chip Select Gating Mask */
148 #define SDR0_CUST0_CHIPSELGAT_DIS       0x00000000 /* Chip Select Gating Disable */
149 #define SDR0_CUST0_CHIPSELGAT_ENALL     0x0000000F /*All Chip Select Gating Enable*/
150 #define SDR0_CUST0_CHIPSELGAT_EN0       0x00000008 /* Chip Select0 Gating Enable */
151 #define SDR0_CUST0_CHIPSELGAT_EN1       0x00000004 /* Chip Select1 Gating Enable */
152 #define SDR0_CUST0_CHIPSELGAT_EN2       0x00000002 /* Chip Select2 Gating Enable */
153 #define SDR0_CUST0_CHIPSELGAT_EN3       0x00000001 /* Chip Select3 Gating Enable */
154
155 #define SDR0_SRST_DMC                   0x00200000
156
157 #define PLLSYS0_ENG_MASK        0x80000000      /* 0 = SysClk, 1 = PLL VCO */
158 #define PLLSYS0_SRC_MASK        0x40000000      /* 0 = PLL A, 1 = PLL B */
159 #define PLLSYS0_SEL_MASK        0x38000000      /* 0 = PLL, 1 = CPU, 5 = PerClk */
160 #define PLLSYS0_TUNE_MASK       0x07fe0000      /* PLL Tune bits */
161 #define PLLSYS0_FB_DIV_MASK     0x0001f000      /* Feedback divisor */
162 #define PLLSYS0_FWD_DIV_A_MASK  0x00000f00      /* Fwd Div A */
163 #define PLLSYS0_FWD_DIV_B_MASK  0x000000e0      /* Fwd Div B */
164 #define PLLSYS0_PRI_DIV_B_MASK  0x0000001c      /* PLL Primary Divisor B */
165 #define PLLSYS0_OPB_DIV_MASK    0x00000003      /* OPB Divisor */
166
167 #define PLLC_ENG_MASK           0x20000000  /* PLL primary forward divisor source */
168 #define PLLC_SRC_MASK           0x20000000  /* PLL feedback source   */
169 #define PLLD_FBDV_MASK          0x1f000000  /* PLL Feedback Divisor  */
170 #define PLLD_FWDVA_MASK         0x000f0000  /* PLL Forward Divisor A */
171 #define PLLD_FWDVB_MASK         0x00000700  /* PLL Forward Divisor B */
172 #define PLLD_LFBDV_MASK         0x0000003f  /* PLL Local Feedback Divisor */
173
174 #define OPBDDV_MASK             0x03000000  /* OPB Clock Divisor Register */
175 #define PERDV_MASK              0x07000000  /* Periferal Clock Divisor */
176 #define PRADV_MASK              0x07000000  /* Primary Divisor A */
177 #define PRBDV_MASK              0x07000000  /* Primary Divisor B */
178 #define SPCID_MASK              0x03000000  /* Sync PCI Divisor  */
179
180 /* Strap 1 Register */
181 #define PLLSYS1_LF_DIV_MASK     0xfc000000      /* PLL Local Feedback Divisor */
182 #define PLLSYS1_PERCLK_DIV_MASK 0x03000000      /* Peripheral Clk Divisor */
183 #define PLLSYS1_MAL_DIV_MASK    0x00c00000      /* MAL Clk Divisor */
184 #define PLLSYS1_RW_MASK         0x00300000      /* ROM width */
185 #define PLLSYS1_EAR_MASK        0x00080000      /* ERAP Addres reset vector */
186 #define PLLSYS1_PAE_MASK        0x00040000      /* PCI arbitor enable */
187 #define PLLSYS1_PCHE_MASK       0x00020000      /* PCI host config enable */
188 #define PLLSYS1_PISE_MASK       0x00010000      /* PCI init seq. enable */
189 #define PLLSYS1_PCWE_MASK       0x00008000      /* PCI local cpu wait enable */
190 #define PLLSYS1_PPIM_MASK       0x00007800      /* PCI inbound map */
191 #define PLLSYS1_PR64E_MASK      0x00000400      /* PCI init Req64 enable */
192 #define PLLSYS1_PXFS_MASK       0x00000300      /* PCI-X Freq Sel */
193 #define PLLSYS1_RSVD_MASK       0x00000080      /* RSVD */
194 #define PLLSYS1_PDM_MASK        0x00000040      /* PCI-X Driver Mode */
195 #define PLLSYS1_EPS_MASK        0x00000038      /* Ethernet Pin Select */
196 #define PLLSYS1_RMII_MASK       0x00000004      /* RMII Mode */
197 #define PLLSYS1_TRE_MASK        0x00000002      /* GPIO Trace Enable */
198 #define PLLSYS1_NTO1_MASK       0x00000001      /* CPU:PLB N-to-1 ratio */
199
200 #define CPR0_ICFG_RLI_MASK      0x80000000
201 #define CPR0_ICFG_ICS_MASK      0x00000007
202 #define CPR0_SPCID_SPCIDV0_MASK 0x03000000
203 #define CPR0_SPCID_SPCIDV0_DIV1 0x01000000
204 #define CPR0_SPCID_SPCIDV0_DIV2 0x02000000
205 #define CPR0_SPCID_SPCIDV0_DIV3 0x03000000
206 #define CPR0_SPCID_SPCIDV0_DIV4 0x00000000
207 #define CPR0_PERD_PERDV0_MASK   0x07000000
208
209 #define PCI_MMIO_LCR_BASE       (CONFIG_SYS_PCI_BASE + 0x0f400000) /* Real =>
210                                                                       0x0EF400000 */
211
212 /* PCI Master Local Configuration Registers */
213 #define PCIL0_PMM0LA            (PCI_MMIO_LCR_BASE + 0x00) /* PMM0 Local Address */
214 #define PCIL0_PMM0MA            (PCI_MMIO_LCR_BASE + 0x04) /* PMM0 Mask/Attribute */
215 #define PCIL0_PMM0PCILA         (PCI_MMIO_LCR_BASE + 0x08) /* PMM0 PCI Low Address */
216 #define PCIL0_PMM0PCIHA         (PCI_MMIO_LCR_BASE + 0x0C) /* PMM0 PCI High Address */
217 #define PCIL0_PMM1LA            (PCI_MMIO_LCR_BASE + 0x10) /* PMM1 Local Address */
218 #define PCIL0_PMM1MA            (PCI_MMIO_LCR_BASE + 0x14) /* PMM1 Mask/Attribute */
219 #define PCIL0_PMM1PCILA         (PCI_MMIO_LCR_BASE + 0x18) /* PMM1 PCI Low Address */
220 #define PCIL0_PMM1PCIHA         (PCI_MMIO_LCR_BASE + 0x1C) /* PMM1 PCI High Address */
221 #define PCIL0_PMM2LA            (PCI_MMIO_LCR_BASE + 0x20) /* PMM2 Local Address */
222 #define PCIL0_PMM2MA            (PCI_MMIO_LCR_BASE + 0x24) /* PMM2 Mask/Attribute */
223 #define PCIL0_PMM2PCILA         (PCI_MMIO_LCR_BASE + 0x28) /* PMM2 PCI Low Address */
224 #define PCIL0_PMM2PCIHA         (PCI_MMIO_LCR_BASE + 0x2C) /* PMM2 PCI High Address */
225
226 /* PCI Target Local Configuration Registers */
227 #define PCIL0_PTM1MS            (PCI_MMIO_LCR_BASE + 0x30) /* PTM1 Memory Size/
228                                                               Attribute */
229 #define PCIL0_PTM1LA            (PCI_MMIO_LCR_BASE + 0x34) /* PTM1 Local Addr. Reg */
230 #define PCIL0_PTM2MS            (PCI_MMIO_LCR_BASE + 0x38) /* PTM2 Memory Size/
231                                                               Attribute */
232 #define PCIL0_PTM2LA            (PCI_MMIO_LCR_BASE + 0x3C) /* PTM2 Local Addr. Reg */
233
234 #endif /* _PPC440EP_GR_H_ */