]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/standalone_v4_1/src/xil_misc_psreset_api.h
Add back Zynq demo - this time using SDK V14.2.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / standalone_v4_1 / src / xil_misc_psreset_api.h
1 /******************************************************************************
2 *
3 * (c) Copyright 2013  Xilinx, Inc. All rights reserved.
4 *
5 * This file contains confidential and proprietary information of Xilinx, Inc.
6 * and is protected under U.S. and international copyright and other
7 * intellectual property laws.
8 *
9 * DISCLAIMER
10 * This disclaimer is not a license and does not grant any rights to the
11 * materials distributed herewith. Except as otherwise provided in a valid
12 * license issued to you by Xilinx, and to the maximum extent permitted by
13 * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
14 * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
15 * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
16 * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
17 * and (2) Xilinx shall not be liable (whether in contract or tort, including
18 * negligence, or under any other theory of liability) for any loss or damage
19 * of any kind or nature related to, arising under or in connection with these
20 * materials, including for any direct, or any indirect, special, incidental,
21 * or consequential loss or damage (including loss of data, profits, goodwill,
22 * or any type of loss or damage suffered as a result of any action brought by
23 * a third party) even if such damage or loss was reasonably foreseeable or
24 * Xilinx had been advised of the possibility of the same.
25 *
26 * CRITICAL APPLICATIONS
27 * Xilinx products are not designed or intended to be fail-safe, or for use in
28 * any application requiring fail-safe performance, such as life-support or
29 * safety devices or systems, Class III medical devices, nuclear facilities,
30 * applications related to the deployment of airbags, or any other applications
31 * that could lead to death, personal injury, or severe property or
32 * environmental damage (individually and collectively, "Critical
33 * Applications"). Customer assumes the sole risk and liability of any use of
34 * Xilinx products in Critical Applications, subject only to applicable laws
35 * and regulations governing limitations on product liability.
36 *
37 * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
38 * AT ALL TIMES.
39 *
40 ******************************************************************************/
41 /*****************************************************************************/
42 /**
43 * @file xil_misc_psreset_api.h
44 *
45 * This file contains the various register defintions and function prototypes for
46 * implementing the reset functionality of zynq ps devices
47 *
48 * MODIFICATION HISTORY:
49 *
50 * Ver   Who    Date   Changes
51 * ----- ---- -------- -------------------------------------------------------
52 * 1.00b kpc   03/07/13 First release.
53 * </pre>
54 *
55 ******************************************************************************/
56
57 #ifndef XIL_MISC_RESET_H                /* prevent circular inclusions */
58 #define XIL_MISC_RESET_H                /* by using protection macros */
59
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63
64
65 /***************************** Include Files *********************************/
66 #include "xil_types.h"
67 #include "xil_io.h"
68
69 /************************** Constant Definitions *****************************/
70 #define XDDRC_CTRL_BASEADDR                             0xF8006000
71 #define XSLCR_BASEADDR                                  0xF8000000      
72 /**< OCM configuration register */              
73 #define XSLCR_OCM_CFG_ADDR                              (XSLCR_BASEADDR + 0x910) 
74 /**< SLCR unlock register */            
75 #define XSLCR_UNLOCK_ADDR                               (XSLCR_BASEADDR + 0x8) 
76 /**< SLCR GEM0 rx clock control register */             
77 #define XSLCR_GEM0_RCLK_CTRL_ADDR               (XSLCR_BASEADDR + 0x138)
78 /**< SLCR GEM1 rx clock control register */             
79 #define XSLCR_GEM1_RCLK_CTRL_ADDR               (XSLCR_BASEADDR + 0x13C)
80 /**< SLCR GEM0 clock control register */                
81 #define XSLCR_GEM0_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x140)
82 /**< SLCR GEM1 clock control register */                
83 #define XSLCR_GEM1_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x144)
84 /**< SLCR SMC clock control register */ 
85 #define XSLCR_SMC_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x148)
86 /**< SLCR GEM reset control register */ 
87 #define XSLCR_GEM_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x214)
88 /**< SLCR USB0 clock control register */        
89 #define XSLCR_USB0_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x130)
90 /**< SLCR USB1 clock control register */        
91 #define XSLCR_USB1_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x134)
92 /**< SLCR USB1 reset control register */
93 #define XSLCR_USB_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x210)
94 /**< SLCR SMC reset control register */
95 #define XSLCR_SMC_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x234)
96 /**< SLCR Level shifter enable register */
97 #define XSLCR_LVL_SHFTR_EN_ADDR                 (XSLCR_BASEADDR + 0x900)
98 /**< SLCR ARM pll control register */
99 #define XSLCR_ARM_PLL_CTRL_ADDR                 (XSLCR_BASEADDR + 0x100)
100 /**< SLCR DDR pll control register */
101 #define XSLCR_DDR_PLL_CTRL_ADDR                 (XSLCR_BASEADDR + 0x104)
102 /**< SLCR IO pll control register */
103 #define XSLCR_IO_PLL_CTRL_ADDR                  (XSLCR_BASEADDR + 0x108)
104 /**< SLCR ARM pll configuration register */
105 #define XSLCR_ARM_PLL_CFG_ADDR                  (XSLCR_BASEADDR + 0x110)
106 /**< SLCR DDR pll configuration register */
107 #define XSLCR_DDR_PLL_CFG_ADDR                  (XSLCR_BASEADDR + 0x114)
108 /**< SLCR IO pll configuration register */
109 #define XSLCR_IO_PLL_CFG_ADDR                   (XSLCR_BASEADDR + 0x118)
110 /**< SLCR ARM clock control register */
111 #define XSLCR_ARM_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x120)
112 /**< SLCR DDR clock control register */
113 #define XSLCR_DDR_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x124)
114 /**< SLCR MIO pin address register */
115 #define XSLCR_MIO_PIN_00_ADDR                   (XSLCR_BASEADDR + 0x700)
116 /**< SLCR DMAC reset control address register */
117 #define XSLCR_DMAC_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x20C)
118 /**< SLCR USB reset control address register */
119 #define XSLCR_USB_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x210)
120 /**< SLCR GEM reset control address register */
121 #define XSLCR_GEM_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x214)
122 /**< SLCR SDIO reset control address register */
123 #define XSLCR_SDIO_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x218)
124 /**< SLCR SPI reset control address register */
125 #define XSLCR_SPI_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x21C)
126 /**< SLCR CAN reset control address register */
127 #define XSLCR_CAN_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x220)
128 /**< SLCR I2C reset control address register */
129 #define XSLCR_I2C_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x224)
130 /**< SLCR UART reset control address register */
131 #define XSLCR_UART_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x228)
132 /**< SLCR GPIO reset control address register */
133 #define XSLCR_GPIO_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x22C)
134 /**< SLCR LQSPI reset control address register */
135 #define XSLCR_LQSPI_RST_CTRL_ADDR                       (XSLCR_BASEADDR + 0x230)
136 /**< SLCR SMC reset control address register */
137 #define XSLCR_SMC_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x234)
138 /**< SLCR OCM reset control address register */
139 #define XSLCR_OCM_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x238)
140
141 /**< SMC mem controller clear config register */
142 #define XSMC_MEMC_CLR_CONFIG_OFFSET                     0x0C
143 /**< SMC idlecount configuration register */
144 #define XSMC_REFRESH_PERIOD_0_OFFSET            0x20
145 #define XSMC_REFRESH_PERIOD_1_OFFSET            0x24
146 /**< SMC ECC configuration register */
147 #define XSMC_ECC_MEMCFG1_OFFSET                         0x404
148 /**< SMC ECC command 1 register */
149 #define XSMC_ECC_MEMCMD1_OFFSET                         0x404
150 /**< SMC ECC command 2 register */
151 #define XSMC_ECC_MEMCMD2_OFFSET                         0x404
152
153 /**< SLCR unlock code */
154 #define XSLCR_UNLOCK_CODE               0x0000DF0D
155
156 /**< SMC mem clear configuration mask */
157 #define XSMC_MEMC_CLR_CONFIG_MASK       0x5F
158 /**< SMC ECC memconfig 1 reset value */
159 #define XSMC_ECC_MEMCFG1_RESET_VAL      0x43
160 /**< SMC ECC memcommand 1 reset value */
161 #define XSMC_ECC_MEMCMD1_RESET_VAL      0x01300080
162 /**< SMC ECC memcommand 2 reset value */
163 #define XSMC_ECC_MEMCMD2_RESET_VAL      0x01E00585
164
165 /**< DDR controller reset bit mask */
166 #define XDDRPS_CTRL_RESET_MASK          0x1
167 /**< SLCR OCM configuration reset value*/
168 #define XSLCR_OCM_CFG_RESETVAL          0x8
169 /**< SLCR OCM bank selection mask*/
170 #define XSLCR_OCM_CFG_HIADDR_MASK       0xF
171 /**< SLCR level shifter enable mask*/
172 #define XSLCR_LVL_SHFTR_EN_MASK         0xF
173
174 /**< SLCR PLL register reset values */
175 #define XSLCR_ARM_PLL_CTRL_RESET_VAL    0x0001A008      
176 #define XSLCR_DDR_PLL_CTRL_RESET_VAL    0x0001A008
177 #define XSLCR_IO_PLL_CTRL_RESET_VAL             0x0001A008
178 #define XSLCR_ARM_PLL_CFG_RESET_VAL             0x00177EA0
179 #define XSLCR_DDR_PLL_CFG_RESET_VAL             0x00177EA0
180 #define XSLCR_IO_PLL_CFG_RESET_VAL              0x00177EA0
181 #define XSLCR_ARM_CLK_CTRL_RESET_VAL    0x1F000400
182 #define XSLCR_DDR_CLK_CTRL_RESET_VAL    0x18400003
183
184 /**< SLCR MIO register default values */
185 #define XSLCR_MIO_PIN_00_RESET_VAL              0x00001601
186 #define XSLCR_MIO_PIN_02_RESET_VAL              0x00000601
187
188 /**< SLCR Reset control registers default values */
189 #define XSLCR_DMAC_RST_CTRL_VAL                 0x1
190 #define XSLCR_GEM_RST_CTRL_VAL                  0xF3
191 #define XSLCR_USB_RST_CTRL_VAL                  0x3                     
192 #define XSLCR_I2C_RST_CTRL_VAL                  0x3
193 #define XSLCR_SPI_RST_CTRL_VAL                  0xF
194 #define XSLCR_UART_RST_CTRL_VAL                 0xF
195 #define XSLCR_QSPI_RST_CTRL_VAL                 0x3
196 #define XSLCR_GPIO_RST_CTRL_VAL                 0x1
197 #define XSLCR_SMC_RST_CTRL_VAL                  0x3
198 #define XSLCR_OCM_RST_CTRL_VAL                  0x1             
199 #define XSLCR_SDIO_RST_CTRL_VAL                 0x33
200 #define XSLCR_CAN_RST_CTRL_VAL                  0x3
201 /**************************** Type Definitions *******************************/
202
203 /* the following data type is used to hold a null terminated version string
204  * consisting of the following format, "X.YYX"
205  */
206
207
208 /***************** Macros (Inline Functions) Definitions *********************/
209
210
211 /************************** Function Prototypes ******************************/
212 /*
213  * Performs reset operation to the ddr interface
214  */
215 void XDdr_ResetHw();
216 /*
217  * Map the ocm region to post bootrom state
218  */
219 void XOcm_Remap();
220 /*
221  * Performs the smc interface reset
222  */
223 void XSmc_ResetHw(u32 BaseAddress);
224 /*
225  * updates the MIO registers with reset values
226  */
227 void XSlcr_MioWriteResetValues();
228 /*
229  * updates the PLL and clock registers with reset values
230  */
231 void XSlcr_PllWriteResetValues();
232 /*
233  * Disables the level shifters
234  */
235 void XSlcr_DisableLevelShifters();
236 /*
237  * provides softreset to the GPIO interface
238  */
239 void XSlcr_GpioPsReset(void);
240 /*
241  * provides softreset to the DMA interface
242  */
243 void XSlcr_DmaPsReset(void);
244 /*
245  * provides softreset to the SMC interface
246  */
247 void XSlcr_SmcPsReset(void);
248 /*
249  * provides softreset to the CAN interface
250  */
251 void XSlcr_CanPsReset(void);
252 /*
253  * provides softreset to the Uart interface
254  */
255 void XSlcr_UartPsReset(void);
256 /*
257  * provides softreset to the I2C interface
258  */
259 void XSlcr_I2cPsReset(void);
260 /*
261  * provides softreset to the SPI interface
262  */
263 void XSlcr_SpiPsReset(void);
264 /*
265  * provides softreset to the QSPI interface
266  */
267 void XSlcr_QspiPsReset(void);
268 /*
269  * provides softreset to the USB interface
270  */
271 void XSlcr_UsbPsReset(void);
272 /*
273  * provides softreset to the GEM interface
274  */
275 void XSlcr_EmacPsReset(void);
276 /*
277  * provides softreset to the OCM interface
278  */
279 void XSlcr_OcmReset(void);
280
281
282 #ifdef __cplusplus
283 }
284 #endif
285
286 #endif /* XIL_MISC_RESET_H */