]> git.sur5r.net Git - u-boot/blob - board/xilinx/zynq/zed_hw_platform/ps7_init_gpl.h
cd8ead4c0aa5837ad0c96adf7dc657307273e8ac
[u-boot] / board / xilinx / zynq / zed_hw_platform / ps7_init_gpl.h
1
2 /******************************************************************************
3 *
4 * (c) Copyright 2010-2014 Xilinx, Inc. All rights reserved.
5 *
6 *  This program is free software; you can redistribute it and/or modify
7 *  it under the terms of the GNU General Public License as published by
8 *  the Free Software Foundation; either version 2 of the License, or
9 *  (at your option) any later version.
10 *
11 *  This program is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *  GNU General Public License for more details.
15 *
16 *  You should have received a copy of the GNU General Public License along
17 *  with this program; if not, see <http://www.gnu.org/licenses/>
18 *
19 *
20 *******************************************************************************/
21 /****************************************************************************/
22 /**
23 *
24 * @file ps7_init.h
25 *
26 * This file can be included in FSBL code
27 * to get prototype of ps7_init() function
28 * and error codes
29 *
30 *****************************************************************************/
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37 //typedef unsigned int  u32;
38
39
40 /** do we need to make this name more unique ? **/
41 //extern u32 ps7_init_data[];
42 extern unsigned long  * ps7_ddr_init_data;
43 extern unsigned long  * ps7_mio_init_data;
44 extern unsigned long  * ps7_pll_init_data;
45 extern unsigned long  * ps7_clock_init_data;
46 extern unsigned long  * ps7_peripherals_init_data;
47
48
49
50 #define OPCODE_EXIT       0U
51 #define OPCODE_CLEAR      1U
52 #define OPCODE_WRITE      2U
53 #define OPCODE_MASKWRITE  3U
54 #define OPCODE_MASKPOLL   4U
55 #define OPCODE_MASKDELAY  5U
56 #define NEW_PS7_ERR_CODE 1
57
58 /* Encode number of arguments in last nibble */
59 #define EMIT_EXIT()                   ( (OPCODE_EXIT      << 4 ) | 0 )
60 #define EMIT_CLEAR(addr)              ( (OPCODE_CLEAR     << 4 ) | 1 ) , addr
61 #define EMIT_WRITE(addr,val)          ( (OPCODE_WRITE     << 4 ) | 2 ) , addr, val
62 #define EMIT_MASKWRITE(addr,mask,val) ( (OPCODE_MASKWRITE << 4 ) | 3 ) , addr, mask, val
63 #define EMIT_MASKPOLL(addr,mask)      ( (OPCODE_MASKPOLL  << 4 ) | 2 ) , addr, mask
64 #define EMIT_MASKDELAY(addr,mask)      ( (OPCODE_MASKDELAY << 4 ) | 2 ) , addr, mask
65
66 /* Returns codes  of PS7_Init */
67 #define PS7_INIT_SUCCESS   (0)    // 0 is success in good old C
68 #define PS7_INIT_CORRUPT   (1)    // 1 the data is corrupted, and slcr reg are in corrupted state now
69 #define PS7_INIT_TIMEOUT   (2)    // 2 when a poll operation timed out
70 #define PS7_POLL_FAILED_DDR_INIT (3)    // 3 when a poll operation timed out for ddr init
71 #define PS7_POLL_FAILED_DMA      (4)    // 4 when a poll operation timed out for dma done bit
72 #define PS7_POLL_FAILED_PLL      (5)    // 5 when a poll operation timed out for pll sequence init
73
74
75 /* Silicon Versions */
76 #define PCW_SILICON_VERSION_1 0
77 #define PCW_SILICON_VERSION_2 1
78 #define PCW_SILICON_VERSION_3 2
79
80 /* This flag to be used by FSBL to check whether ps7_post_config() proc exixts */
81 #define PS7_POST_CONFIG
82
83 /* Freq of all peripherals */
84
85 #define APU_FREQ  666666687
86 #define DDR_FREQ  533333374
87 #define DCI_FREQ  10158731
88 #define QSPI_FREQ  200000000
89 #define SMC_FREQ  10000000
90 #define ENET0_FREQ  125000000
91 #define ENET1_FREQ  10000000
92 #define USB0_FREQ  60000000
93 #define USB1_FREQ  60000000
94 #define SDIO_FREQ  50000000
95 #define UART_FREQ  50000000
96 #define SPI_FREQ  10000000
97 #define I2C_FREQ  111111115
98 #define WDT_FREQ  111111115
99 #define TTC_FREQ  50000000
100 #define CAN_FREQ  10000000
101 #define PCAP_FREQ  200000000
102 #define TPIU_FREQ  200000000
103 #define FPGA0_FREQ  100000000
104 #define FPGA1_FREQ  142857132
105 #define FPGA2_FREQ  50000000
106 #define FPGA3_FREQ  50000000
107
108
109 /* For delay calculation using global registers*/
110 #define SCU_GLOBAL_TIMER_COUNT_L32      0xF8F00200
111 #define SCU_GLOBAL_TIMER_COUNT_U32      0xF8F00204
112 #define SCU_GLOBAL_TIMER_CONTROL        0xF8F00208
113 #define SCU_GLOBAL_TIMER_AUTO_INC       0xF8F00218
114
115 int ps7_config( unsigned long*);
116 int ps7_init();
117 int ps7_post_config();
118 int ps7_debug();
119 char* getPS7MessageInfo(unsigned key);
120
121 void perf_start_clock(void);
122 void perf_disable_clock(void);
123 void perf_reset_clock(void);
124 void perf_reset_and_start_timer();
125 int get_number_of_cycles_for_delay(unsigned int delay);
126 #ifdef __cplusplus
127 }
128 #endif