]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/standalone_v6_6/src/xil_misc_psreset_api.h
Update Zynq, MPSoc Cortex-A53 and MPSoc Cortex-R5 demo projects to build with the...
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / standalone_v6_6 / src / xil_misc_psreset_api.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2013 - 2015 Xilinx, Inc.  All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
30 *
31 ******************************************************************************/
32 /*****************************************************************************/
33 /**
34 * @file xil_misc_psreset_api.h
35 *
36 * This file contains the various register defintions and function prototypes for
37 * implementing the reset functionality of zynq ps devices
38 *
39 * MODIFICATION HISTORY:
40 *
41 * Ver   Who    Date   Changes
42 * ----- ---- -------- -------------------------------------------------------
43 * 1.00b kpc   03/07/13 First release.
44 * </pre>
45 *
46 ******************************************************************************/
47
48 #ifndef XIL_MISC_RESET_H                /* prevent circular inclusions */
49 #define XIL_MISC_RESET_H                /* by using protection macros */
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55
56 /***************************** Include Files *********************************/
57 #include "xil_types.h"
58 #include "xil_io.h"
59
60 /************************** Constant Definitions *****************************/
61 #define XDDRC_CTRL_BASEADDR                             0xF8006000U
62 #define XSLCR_BASEADDR                                  0xF8000000U
63 /**< OCM configuration register */
64 #define XSLCR_OCM_CFG_ADDR                              (XSLCR_BASEADDR + 0x00000910U)
65 /**< SLCR unlock register */
66 #define XSLCR_UNLOCK_ADDR                               (XSLCR_BASEADDR + 0x00000008U)
67 /**< SLCR GEM0 rx clock control register */
68 #define XSLCR_GEM0_RCLK_CTRL_ADDR               (XSLCR_BASEADDR + 0x00000138U)
69 /**< SLCR GEM1 rx clock control register */
70 #define XSLCR_GEM1_RCLK_CTRL_ADDR               (XSLCR_BASEADDR + 0x0000013CU)
71 /**< SLCR GEM0 clock control register */
72 #define XSLCR_GEM0_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x00000140U)
73 /**< SLCR GEM1 clock control register */
74 #define XSLCR_GEM1_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x00000144U)
75 /**< SLCR SMC clock control register */
76 #define XSLCR_SMC_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000148U)
77 /**< SLCR GEM reset control register */
78 #define XSLCR_GEM_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000214U)
79 /**< SLCR USB0 clock control register */
80 #define XSLCR_USB0_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x00000130U)
81 /**< SLCR USB1 clock control register */
82 #define XSLCR_USB1_CLK_CTRL_ADDR                (XSLCR_BASEADDR + 0x00000134U)
83 /**< SLCR USB1 reset control register */
84 #define XSLCR_USB_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000210U)
85 /**< SLCR SMC reset control register */
86 #define XSLCR_SMC_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000234U)
87 /**< SLCR Level shifter enable register */
88 #define XSLCR_LVL_SHFTR_EN_ADDR                 (XSLCR_BASEADDR + 0x00000900U)
89 /**< SLCR ARM pll control register */
90 #define XSLCR_ARM_PLL_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000100U)
91 /**< SLCR DDR pll control register */
92 #define XSLCR_DDR_PLL_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000104U)
93 /**< SLCR IO pll control register */
94 #define XSLCR_IO_PLL_CTRL_ADDR                  (XSLCR_BASEADDR + 0x00000108U)
95 /**< SLCR ARM pll configuration register */
96 #define XSLCR_ARM_PLL_CFG_ADDR                  (XSLCR_BASEADDR + 0x00000110U)
97 /**< SLCR DDR pll configuration register */
98 #define XSLCR_DDR_PLL_CFG_ADDR                  (XSLCR_BASEADDR + 0x00000114U)
99 /**< SLCR IO pll configuration register */
100 #define XSLCR_IO_PLL_CFG_ADDR                   (XSLCR_BASEADDR + 0x00000118U)
101 /**< SLCR ARM clock control register */
102 #define XSLCR_ARM_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000120U)
103 /**< SLCR DDR clock control register */
104 #define XSLCR_DDR_CLK_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000124U)
105 /**< SLCR MIO pin address register */
106 #define XSLCR_MIO_PIN_00_ADDR                   (XSLCR_BASEADDR + 0x00000700U)
107 /**< SLCR DMAC reset control address register */
108 #define XSLCR_DMAC_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x0000020CU)
109 /**< SLCR USB reset control address register */
110 /*#define XSLCR_USB_RST_CTRL_ADDR                       (XSLCR_BASEADDR + 0x00000210U)*/
111 /**< SLCR GEM reset control address register */
112 /*#define XSLCR_GEM_RST_CTRL_ADDR                       (XSLCR_BASEADDR + 0x00000214U)*/
113 /**< SLCR SDIO reset control address register */
114 #define XSLCR_SDIO_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x00000218U)
115 /**< SLCR SPI reset control address register */
116 #define XSLCR_SPI_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x0000021CU)
117 /**< SLCR CAN reset control address register */
118 #define XSLCR_CAN_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000220U)
119 /**< SLCR I2C reset control address register */
120 #define XSLCR_I2C_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000224U)
121 /**< SLCR UART reset control address register */
122 #define XSLCR_UART_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x00000228U)
123 /**< SLCR GPIO reset control address register */
124 #define XSLCR_GPIO_RST_CTRL_ADDR                        (XSLCR_BASEADDR + 0x0000022CU)
125 /**< SLCR LQSPI reset control address register */
126 #define XSLCR_LQSPI_RST_CTRL_ADDR                       (XSLCR_BASEADDR + 0x00000230U)
127 /**< SLCR SMC reset control address register */
128 /*#define XSLCR_SMC_RST_CTRL_ADDR                       (XSLCR_BASEADDR + 0x00000234U)*/
129 /**< SLCR OCM reset control address register */
130 #define XSLCR_OCM_RST_CTRL_ADDR                 (XSLCR_BASEADDR + 0x00000238U)
131
132 /**< SMC mem controller clear config register */
133 #define XSMC_MEMC_CLR_CONFIG_OFFSET                     0x0000000CU
134 /**< SMC idlecount configuration register */
135 #define XSMC_REFRESH_PERIOD_0_OFFSET            0x00000020U
136 #define XSMC_REFRESH_PERIOD_1_OFFSET            0x00000024U
137 /**< SMC ECC configuration register */
138 #define XSMC_ECC_MEMCFG1_OFFSET                         0x00000404U
139 /**< SMC ECC command 1 register */
140 #define XSMC_ECC_MEMCMD1_OFFSET                         0x00000404U
141 /**< SMC ECC command 2 register */
142 #define XSMC_ECC_MEMCMD2_OFFSET                         0x00000404U
143
144 /**< SLCR unlock code */
145 #define XSLCR_UNLOCK_CODE               0x0000DF0DU
146
147 /**< SMC mem clear configuration mask */
148 #define XSMC_MEMC_CLR_CONFIG_MASK       0x000005FU
149 /**< SMC ECC memconfig 1 reset value */
150 #define XSMC_ECC_MEMCFG1_RESET_VAL      0x0000043U
151 /**< SMC ECC memcommand 1 reset value */
152 #define XSMC_ECC_MEMCMD1_RESET_VAL      0x01300080U
153 /**< SMC ECC memcommand 2 reset value */
154 #define XSMC_ECC_MEMCMD2_RESET_VAL      0x01E00585U
155
156 /**< DDR controller reset bit mask */
157 #define XDDRPS_CTRL_RESET_MASK          0x00000001U
158 /**< SLCR OCM configuration reset value*/
159 #define XSLCR_OCM_CFG_RESETVAL          0x00000008U
160 /**< SLCR OCM bank selection mask*/
161 #define XSLCR_OCM_CFG_HIADDR_MASK       0x0000000FU
162 /**< SLCR level shifter enable mask*/
163 #define XSLCR_LVL_SHFTR_EN_MASK         0x0000000FU
164
165 /**< SLCR PLL register reset values */
166 #define XSLCR_ARM_PLL_CTRL_RESET_VAL    0x0001A008U
167 #define XSLCR_DDR_PLL_CTRL_RESET_VAL    0x0001A008U
168 #define XSLCR_IO_PLL_CTRL_RESET_VAL             0x0001A008U
169 #define XSLCR_ARM_PLL_CFG_RESET_VAL             0x00177EA0U
170 #define XSLCR_DDR_PLL_CFG_RESET_VAL             0x00177EA0U
171 #define XSLCR_IO_PLL_CFG_RESET_VAL              0x00177EA0U
172 #define XSLCR_ARM_CLK_CTRL_RESET_VAL    0x1F000400U
173 #define XSLCR_DDR_CLK_CTRL_RESET_VAL    0x18400003U
174
175 /**< SLCR MIO register default values */
176 #define XSLCR_MIO_PIN_00_RESET_VAL              0x00001601U
177 #define XSLCR_MIO_PIN_02_RESET_VAL              0x00000601U
178
179 /**< SLCR Reset control registers default values */
180 #define XSLCR_DMAC_RST_CTRL_VAL                 0x00000001U
181 #define XSLCR_GEM_RST_CTRL_VAL                  0x000000F3U
182 #define XSLCR_USB_RST_CTRL_VAL                  0x00000003U
183 #define XSLCR_I2C_RST_CTRL_VAL                  0x00000003U
184 #define XSLCR_SPI_RST_CTRL_VAL                  0x0000000FU
185 #define XSLCR_UART_RST_CTRL_VAL                 0x0000000FU
186 #define XSLCR_QSPI_RST_CTRL_VAL                 0x00000003U
187 #define XSLCR_GPIO_RST_CTRL_VAL                 0x00000001U
188 #define XSLCR_SMC_RST_CTRL_VAL                  0x00000003U
189 #define XSLCR_OCM_RST_CTRL_VAL                  0x00000001U
190 #define XSLCR_SDIO_RST_CTRL_VAL                 0x00000033U
191 #define XSLCR_CAN_RST_CTRL_VAL                  0x00000003U
192 /**************************** Type Definitions *******************************/
193
194 /* the following data type is used to hold a null terminated version string
195  * consisting of the following format, "X.YYX"
196  */
197
198
199 /***************** Macros (Inline Functions) Definitions *********************/
200
201
202 /************************** Function Prototypes ******************************/
203 /*
204  * Performs reset operation to the ddr interface
205  */
206 void XDdr_ResetHw(void);
207 /*
208  * Map the ocm region to post bootrom state
209  */
210 void XOcm_Remap(void);
211 /*
212  * Performs the smc interface reset
213  */
214 void XSmc_ResetHw(u32 BaseAddress);
215 /*
216  * updates the MIO registers with reset values
217  */
218 void XSlcr_MioWriteResetValues(void);
219 /*
220  * updates the PLL and clock registers with reset values
221  */
222 void XSlcr_PllWriteResetValues(void);
223 /*
224  * Disables the level shifters
225  */
226 void XSlcr_DisableLevelShifters(void);
227 /*
228  * provides softreset to the GPIO interface
229  */
230 void XSlcr_GpioPsReset(void);
231 /*
232  * provides softreset to the DMA interface
233  */
234 void XSlcr_DmaPsReset(void);
235 /*
236  * provides softreset to the SMC interface
237  */
238 void XSlcr_SmcPsReset(void);
239 /*
240  * provides softreset to the CAN interface
241  */
242 void XSlcr_CanPsReset(void);
243 /*
244  * provides softreset to the Uart interface
245  */
246 void XSlcr_UartPsReset(void);
247 /*
248  * provides softreset to the I2C interface
249  */
250 void XSlcr_I2cPsReset(void);
251 /*
252  * provides softreset to the SPI interface
253  */
254 void XSlcr_SpiPsReset(void);
255 /*
256  * provides softreset to the QSPI interface
257  */
258 void XSlcr_QspiPsReset(void);
259 /*
260  * provides softreset to the USB interface
261  */
262 void XSlcr_UsbPsReset(void);
263 /*
264  * provides softreset to the GEM interface
265  */
266 void XSlcr_EmacPsReset(void);
267 /*
268  * provides softreset to the OCM interface
269  */
270 void XSlcr_OcmReset(void);
271
272
273 #ifdef __cplusplus
274 }
275 #endif
276
277 #endif /* XIL_MISC_RESET_H */