tizen 2.4 release
[kernel/u-boot-tm1.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
32 /* Memory mapped registers */
33 #define CONFIG_SYS_PERIPHERAL_BASE      0xef600000 /* Internal Peripherals */
34
35 #define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_PERIPHERAL_BASE + 0x0300)
36 #define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_PERIPHERAL_BASE + 0x0400)
37 #define CONFIG_SYS_NS16550_COM3 (CONFIG_SYS_PERIPHERAL_BASE + 0x0500)
38 #define CONFIG_SYS_NS16550_COM4 (CONFIG_SYS_PERIPHERAL_BASE + 0x0600)
39
40 #define GPIO0_BASE              (CONFIG_SYS_PERIPHERAL_BASE + 0x0b00)
41 #define GPIO1_BASE              (CONFIG_SYS_PERIPHERAL_BASE + 0x0c00)
42
43 /* SDR's */
44 #define SDR0_PCI0       0x0300
45 #define SDR0_SDSTP2     0x4001
46 #define SDR0_SDSTP3     0x4003
47
48 #define SDR0_SDSTP1_PAE_MASK            (0x80000000 >> 21)
49 #define SDR0_SDSTP1_PAME_MASK           (0x80000000 >> 27)
50
51 /* Pin Function Control Register 1 */
52 #define SDR0_PFC1_U1ME_MASK             0x02000000 /* UART1 Mode Enable */
53 #define SDR0_PFC1_U1ME_DSR_DTR          0x00000000 /* UART1 in DSR/DTR Mode */
54 #define SDR0_PFC1_U1ME_CTS_RTS          0x02000000 /* UART1 in CTS/RTS Mode */
55 #define SDR0_PFC1_U0ME_MASK             0x00080000 /* UART0 Mode Enable */
56 #define SDR0_PFC1_U0ME_DSR_DTR          0x00000000 /* UART0 in DSR/DTR Mode */
57 #define SDR0_PFC1_U0ME_CTS_RTS          0x00080000 /* UART0 in CTS/RTS Mode */
58 #define SDR0_PFC1_U0IM_MASK             0x00040000 /* UART0 Interface Mode */
59 #define SDR0_PFC1_U0IM_8PINS            0x00000000 /* UART0 Interface Mode 8 pins */
60 #define SDR0_PFC1_U0IM_4PINS            0x00040000 /* UART0 Interface Mode 4 pins */
61 #define SDR0_PFC1_SIS_MASK              0x00020000 /* SCP or IIC1 Selection */
62 #define SDR0_PFC1_SIS_SCP_SEL           0x00000000 /* SCP Selected */
63 #define SDR0_PFC1_SIS_IIC1_SEL          0x00020000 /* IIC1 Selected */
64 #define SDR0_PFC1_UES_MASK              0x00010000 /* USB2D_RX_Active / EBC_Hold
65                                                       Req Selection */
66 #define SDR0_PFC1_UES_USB2D_SEL         0x00000000 /* USB2D_RX_Active Selected */
67 #define SDR0_PFC1_UES_EBCHR_SEL         0x00010000 /* EBC_Hold Req Selected */
68 #define SDR0_PFC1_DIS_MASK              0x00008000 /* DMA_Req(1) / UIC_IRQ(5)
69                                                       Selection */
70 #define SDR0_PFC1_DIS_DMAR_SEL          0x00000000 /* DMA_Req(1) Selected */
71 #define SDR0_PFC1_DIS_UICIRQ5_SEL       0x00008000 /* UIC_IRQ(5) Selected */
72 #define SDR0_PFC1_ERE_MASK              0x00004000 /* EBC Mast.Ext.Req.En./GPIO0(27)
73                                                       Selection */
74 #define SDR0_PFC1_ERE_EXTR_SEL          0x00000000 /* EBC Mast.Ext.Req.En.
75                                                       Selected */
76 #define SDR0_PFC1_ERE_GPIO0_27_SEL      0x00004000 /* GPIO0(27) Selected */
77 #define SDR0_PFC1_UPR_MASK              0x00002000 /* USB2 Device Packet Reject
78                                                       Selection */
79 #define SDR0_PFC1_UPR_DISABLE           0x00000000 /* USB2 Device Packet Reject
80                                                       Disable */
81 #define SDR0_PFC1_UPR_ENABLE            0x00002000 /* USB2 Device Packet Reject
82                                                       Enable */
83 #define SDR0_PFC1_PLB_PME_MASK          0x00001000 /* PLB3/PLB4 Perf. Monitor Enable
84                                                       Selection */
85 #define SDR0_PFC1_PLB_PME_PLB3_SEL      0x00000000 /* PLB3 Performance Monitor
86                                                       Enable */
87 #define SDR0_PFC1_PLB_PME_PLB4_SEL      0x00001000 /* PLB3 Performance Monitor
88                                                       Enable */
89 #define SDR0_PFC1_GFGGI_MASK            0x0000000F /* GPT Frequency Generation
90                                                       Gated In */
91
92 /* USB Control Register */
93 #define SDR0_USB0_USB_DEVSEL_MASK       0x00000002 /* USB Device Selection */
94 #define SDR0_USB0_USB20D_DEVSEL         0x00000000 /* USB2.0 Device Selected */
95 #define SDR0_USB0_USB11D_DEVSEL         0x00000002 /* USB1.1 Device Selected */
96 #define SDR0_USB0_LEEN_MASK             0x00000001 /* Little Endian selection */
97 #define SDR0_USB0_LEEN_DISABLE          0x00000000 /* Little Endian Disable */
98 #define SDR0_USB0_LEEN_ENABLE           0x00000001 /* Little Endian Enable */
99
100 /* Miscealleneaous Function Reg. */
101 #define SDR0_MFR_ETH0_CLK_SEL_MASK      0x08000000 /* Ethernet0 Clock Select */
102 #define SDR0_MFR_ETH0_CLK_SEL_EXT       0x00000000
103 #define SDR0_MFR_ETH1_CLK_SEL_MASK      0x04000000 /* Ethernet1 Clock Select */
104 #define SDR0_MFR_ETH1_CLK_SEL_EXT       0x00000000
105 #define SDR0_MFR_ZMII_MODE_MASK         0x03000000 /* ZMII Mode Mask */
106 #define SDR0_MFR_ZMII_MODE_MII          0x00000000 /* ZMII Mode MII */
107 #define SDR0_MFR_ZMII_MODE_SMII         0x01000000 /* ZMII Mode SMII */
108 #define SDR0_MFR_ZMII_MODE_RMII_10M     0x02000000 /* ZMII Mode RMII - 10 Mbs */
109 #define SDR0_MFR_ZMII_MODE_RMII_100M    0x03000000 /* ZMII Mode RMII - 100 Mbs */
110 #define SDR0_MFR_ZMII_MODE_BIT0         0x02000000 /* ZMII Mode Bit0 */
111 #define SDR0_MFR_ZMII_MODE_BIT1         0x01000000 /* ZMII Mode Bit1 */
112 #define SDR0_MFR_ZM_ENCODE(n)           ((((u32)(n)) & 0x3) << 24)
113 #define SDR0_MFR_ZM_DECODE(n)           ((((u32)(n)) << 24) & 0x3)
114
115 #define SDR0_MFR_ERRATA3_EN0            0x00800000
116 #define SDR0_MFR_ERRATA3_EN1            0x00400000
117 #define SDR0_MFR_PKT_REJ_MASK           0x00180000 /* Pkt Rej. Enable Mask */
118 #define SDR0_MFR_PKT_REJ_EN             0x00180000 /* Pkt Rej. Ena. on both EMAC3 0-1 */
119 #define SDR0_MFR_PKT_REJ_EN0            0x00100000 /* Pkt Rej. Enable on EMAC3(0) */
120 #define SDR0_MFR_PKT_REJ_EN1            0x00080000 /* Pkt Rej. Enable on EMAC3(1) */
121 #define SDR0_MFR_PKT_REJ_POL            0x00200000 /* Packet Reject Polarity */
122
123 /* CUST0 Customer Configuration Register0 */
124 #define SDR0_CUST0_MUX_E_N_G_MASK       0xC0000000 /* Mux_Emac_NDFC_GPIO */
125 #define SDR0_CUST0_MUX_EMAC_SEL         0x40000000 /* Emac Selection */
126 #define SDR0_CUST0_MUX_NDFC_SEL         0x80000000 /* NDFC Selection */
127 #define SDR0_CUST0_MUX_GPIO_SEL         0xC0000000 /* GPIO Selection */
128
129 #define SDR0_CUST0_NDFC_EN_MASK         0x20000000 /* NDFC Enable Mask */
130 #define SDR0_CUST0_NDFC_ENABLE          0x20000000 /* NDFC Enable */
131 #define SDR0_CUST0_NDFC_DISABLE         0x00000000 /* NDFC Disable */
132
133 #define SDR0_CUST0_NDFC_BW_MASK         0x10000000 /* NDFC Boot Width */
134 #define SDR0_CUST0_NDFC_BW_16_BIT       0x10000000 /* NDFC Boot Width = 16 Bit */
135 #define SDR0_CUST0_NDFC_BW_8_BIT        0x00000000 /* NDFC Boot Width =  8 Bit */
136
137 #define SDR0_CUST0_NDFC_BP_MASK         0x0F000000 /* NDFC Boot Page */
138 #define SDR0_CUST0_NDFC_BP_ENCODE(n)    ((((u32)(n)) & 0xF) << 24)
139 #define SDR0_CUST0_NDFC_BP_DECODE(n)    ((((u32)(n)) >> 24) & 0xF)
140
141 #define SDR0_CUST0_NDFC_BAC_MASK        0x00C00000 /* NDFC Boot Address Cycle */
142 #define SDR0_CUST0_NDFC_BAC_ENCODE(n)   ((((u32)(n)) & 0x3) << 22)
143 #define SDR0_CUST0_NDFC_BAC_DECODE(n)   ((((u32)(n)) >> 22) & 0x3)
144
145 #define SDR0_CUST0_NDFC_ARE_MASK        0x00200000 /* NDFC Auto Read Enable */
146 #define SDR0_CUST0_NDFC_ARE_ENABLE      0x00200000 /* NDFC Auto Read Enable */
147 #define SDR0_CUST0_NDFC_ARE_DISABLE     0x00000000 /* NDFC Auto Read Disable */
148
149 #define SDR0_CUST0_NRB_MASK             0x00100000 /* NDFC Ready / Busy */
150 #define SDR0_CUST0_NRB_BUSY             0x00100000 /* Busy */
151 #define SDR0_CUST0_NRB_READY            0x00000000 /* Ready */
152
153 #define SDR0_CUST0_NDRSC_MASK           0x0000FFF0 /* NDFC Device Reset Count Mask */
154 #define SDR0_CUST0_NDRSC_ENCODE(n)      ((((u32)(n)) & 0xFFF) << 4)
155 #define SDR0_CUST0_NDRSC_DECODE(n)      ((((u32)(n)) >> 4) & 0xFFF)
156
157 #define SDR0_CUST0_CHIPSELGAT_MASK      0x0000000F /* Chip Select Gating Mask */
158 #define SDR0_CUST0_CHIPSELGAT_DIS       0x00000000 /* Chip Select Gating Disable */
159 #define SDR0_CUST0_CHIPSELGAT_ENALL     0x0000000F /*All Chip Select Gating Enable*/
160 #define SDR0_CUST0_CHIPSELGAT_EN0       0x00000008 /* Chip Select0 Gating Enable */
161 #define SDR0_CUST0_CHIPSELGAT_EN1       0x00000004 /* Chip Select1 Gating Enable */
162 #define SDR0_CUST0_CHIPSELGAT_EN2       0x00000002 /* Chip Select2 Gating Enable */
163 #define SDR0_CUST0_CHIPSELGAT_EN3       0x00000001 /* Chip Select3 Gating Enable */
164
165 #define SDR0_SRST_DMC                   0x00200000
166
167 #define PLLSYS0_ENG_MASK        0x80000000      /* 0 = SysClk, 1 = PLL VCO */
168 #define PLLSYS0_SRC_MASK        0x40000000      /* 0 = PLL A, 1 = PLL B */
169 #define PLLSYS0_SEL_MASK        0x38000000      /* 0 = PLL, 1 = CPU, 5 = PerClk */
170 #define PLLSYS0_TUNE_MASK       0x07fe0000      /* PLL Tune bits */
171 #define PLLSYS0_FB_DIV_MASK     0x0001f000      /* Feedback divisor */
172 #define PLLSYS0_FWD_DIV_A_MASK  0x00000f00      /* Fwd Div A */
173 #define PLLSYS0_FWD_DIV_B_MASK  0x000000e0      /* Fwd Div B */
174 #define PLLSYS0_PRI_DIV_B_MASK  0x0000001c      /* PLL Primary Divisor B */
175 #define PLLSYS0_OPB_DIV_MASK    0x00000003      /* OPB Divisor */
176
177 #define PLLC_ENG_MASK           0x20000000  /* PLL primary forward divisor source */
178 #define PLLC_SRC_MASK           0x20000000  /* PLL feedback source   */
179 #define PLLD_FBDV_MASK          0x1f000000  /* PLL Feedback Divisor  */
180 #define PLLD_FWDVA_MASK         0x000f0000  /* PLL Forward Divisor A */
181 #define PLLD_FWDVB_MASK         0x00000700  /* PLL Forward Divisor B */
182 #define PLLD_LFBDV_MASK         0x0000003f  /* PLL Local Feedback Divisor */
183
184 #define OPBDDV_MASK             0x03000000  /* OPB Clock Divisor Register */
185 #define PERDV_MASK              0x07000000  /* Periferal Clock Divisor */
186 #define PRADV_MASK              0x07000000  /* Primary Divisor A */
187 #define PRBDV_MASK              0x07000000  /* Primary Divisor B */
188 #define SPCID_MASK              0x03000000  /* Sync PCI Divisor  */
189
190 /* Strap 1 Register */
191 #define PLLSYS1_LF_DIV_MASK     0xfc000000      /* PLL Local Feedback Divisor */
192 #define PLLSYS1_PERCLK_DIV_MASK 0x03000000      /* Peripheral Clk Divisor */
193 #define PLLSYS1_MAL_DIV_MASK    0x00c00000      /* MAL Clk Divisor */
194 #define PLLSYS1_RW_MASK         0x00300000      /* ROM width */
195 #define PLLSYS1_EAR_MASK        0x00080000      /* ERAP Addres reset vector */
196 #define PLLSYS1_PAE_MASK        0x00040000      /* PCI arbitor enable */
197 #define PLLSYS1_PCHE_MASK       0x00020000      /* PCI host config enable */
198 #define PLLSYS1_PISE_MASK       0x00010000      /* PCI init seq. enable */
199 #define PLLSYS1_PCWE_MASK       0x00008000      /* PCI local cpu wait enable */
200 #define PLLSYS1_PPIM_MASK       0x00007800      /* PCI inbound map */
201 #define PLLSYS1_PR64E_MASK      0x00000400      /* PCI init Req64 enable */
202 #define PLLSYS1_PXFS_MASK       0x00000300      /* PCI-X Freq Sel */
203 #define PLLSYS1_RSVD_MASK       0x00000080      /* RSVD */
204 #define PLLSYS1_PDM_MASK        0x00000040      /* PCI-X Driver Mode */
205 #define PLLSYS1_EPS_MASK        0x00000038      /* Ethernet Pin Select */
206 #define PLLSYS1_RMII_MASK       0x00000004      /* RMII Mode */
207 #define PLLSYS1_TRE_MASK        0x00000002      /* GPIO Trace Enable */
208 #define PLLSYS1_NTO1_MASK       0x00000001      /* CPU:PLB N-to-1 ratio */
209
210 #define CPR0_ICFG_RLI_MASK      0x80000000
211 #define CPR0_ICFG_ICS_MASK      0x00000007
212 #define CPR0_SPCID_SPCIDV0_MASK 0x03000000
213 #define CPR0_SPCID_SPCIDV0_DIV1 0x01000000
214 #define CPR0_SPCID_SPCIDV0_DIV2 0x02000000
215 #define CPR0_SPCID_SPCIDV0_DIV3 0x03000000
216 #define CPR0_SPCID_SPCIDV0_DIV4 0x00000000
217 #define CPR0_PERD_PERDV0_MASK   0x07000000
218
219 #define PCI_MMIO_LCR_BASE       (CONFIG_SYS_PCI_BASE + 0x0f400000) /* Real =>
220                                                                       0x0EF400000 */
221
222 /* PCI Master Local Configuration Registers */
223 #define PCIL0_PMM0LA            (PCI_MMIO_LCR_BASE + 0x00) /* PMM0 Local Address */
224 #define PCIL0_PMM0MA            (PCI_MMIO_LCR_BASE + 0x04) /* PMM0 Mask/Attribute */
225 #define PCIL0_PMM0PCILA         (PCI_MMIO_LCR_BASE + 0x08) /* PMM0 PCI Low Address */
226 #define PCIL0_PMM0PCIHA         (PCI_MMIO_LCR_BASE + 0x0C) /* PMM0 PCI High Address */
227 #define PCIL0_PMM1LA            (PCI_MMIO_LCR_BASE + 0x10) /* PMM1 Local Address */
228 #define PCIL0_PMM1MA            (PCI_MMIO_LCR_BASE + 0x14) /* PMM1 Mask/Attribute */
229 #define PCIL0_PMM1PCILA         (PCI_MMIO_LCR_BASE + 0x18) /* PMM1 PCI Low Address */
230 #define PCIL0_PMM1PCIHA         (PCI_MMIO_LCR_BASE + 0x1C) /* PMM1 PCI High Address */
231 #define PCIL0_PMM2LA            (PCI_MMIO_LCR_BASE + 0x20) /* PMM2 Local Address */
232 #define PCIL0_PMM2MA            (PCI_MMIO_LCR_BASE + 0x24) /* PMM2 Mask/Attribute */
233 #define PCIL0_PMM2PCILA         (PCI_MMIO_LCR_BASE + 0x28) /* PMM2 PCI Low Address */
234 #define PCIL0_PMM2PCIHA         (PCI_MMIO_LCR_BASE + 0x2C) /* PMM2 PCI High Address */
235
236 /* PCI Target Local Configuration Registers */
237 #define PCIL0_PTM1MS            (PCI_MMIO_LCR_BASE + 0x30) /* PTM1 Memory Size/
238                                                               Attribute */
239 #define PCIL0_PTM1LA            (PCI_MMIO_LCR_BASE + 0x34) /* PTM1 Local Addr. Reg */
240 #define PCIL0_PTM2MS            (PCI_MMIO_LCR_BASE + 0x38) /* PTM2 Memory Size/
241                                                               Attribute */
242 #define PCIL0_PTM2LA            (PCI_MMIO_LCR_BASE + 0x3C) /* PTM2 Local Addr. Reg */
243
244 #endif /* _PPC440EP_GR_H_ */