Commit fb4000e87178bf20aeb0d6c6a71b0e25ff8dcda3

Authored by Michal Simek
1 parent 7033ae272e

arm64: zynqmp: Check pmufw version

If PMUFW version is not v0.3 then panic.
ZynqMP switch to CCF based clock driver which requires
PMUFW to be present at certain version.
This patch ensure that you use correct and tested PMUFW
binary.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Showing 4 changed files with 46 additions and 0 deletions Inline Diff

arch/arm/cpu/armv8/zynqmp/cpu.c
1 /* 1 /*
2 * (C) Copyright 2014 - 2015 Xilinx, Inc. 2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com> 3 * Michal Simek <michal.simek@xilinx.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #include <common.h> 8 #include <common.h>
9 #include <asm/arch/hardware.h> 9 #include <asm/arch/hardware.h>
10 #include <asm/arch/sys_proto.h> 10 #include <asm/arch/sys_proto.h>
11 #include <asm/armv8/mmu.h> 11 #include <asm/armv8/mmu.h>
12 #include <asm/io.h> 12 #include <asm/io.h>
13 13
14 #define ZYNQ_SILICON_VER_MASK 0xF000 14 #define ZYNQ_SILICON_VER_MASK 0xF000
15 #define ZYNQ_SILICON_VER_SHIFT 12 15 #define ZYNQ_SILICON_VER_SHIFT 12
16 16
17 DECLARE_GLOBAL_DATA_PTR; 17 DECLARE_GLOBAL_DATA_PTR;
18 18
19 static struct mm_region zynqmp_mem_map[] = { 19 static struct mm_region zynqmp_mem_map[] = {
20 { 20 {
21 .virt = 0x0UL, 21 .virt = 0x0UL,
22 .phys = 0x0UL, 22 .phys = 0x0UL,
23 .size = 0x80000000UL, 23 .size = 0x80000000UL,
24 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | 24 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
25 PTE_BLOCK_INNER_SHARE 25 PTE_BLOCK_INNER_SHARE
26 }, { 26 }, {
27 .virt = 0x80000000UL, 27 .virt = 0x80000000UL,
28 .phys = 0x80000000UL, 28 .phys = 0x80000000UL,
29 .size = 0x70000000UL, 29 .size = 0x70000000UL,
30 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | 30 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
31 PTE_BLOCK_NON_SHARE | 31 PTE_BLOCK_NON_SHARE |
32 PTE_BLOCK_PXN | PTE_BLOCK_UXN 32 PTE_BLOCK_PXN | PTE_BLOCK_UXN
33 }, { 33 }, {
34 .virt = 0xf8000000UL, 34 .virt = 0xf8000000UL,
35 .phys = 0xf8000000UL, 35 .phys = 0xf8000000UL,
36 .size = 0x07e00000UL, 36 .size = 0x07e00000UL,
37 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | 37 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
38 PTE_BLOCK_NON_SHARE | 38 PTE_BLOCK_NON_SHARE |
39 PTE_BLOCK_PXN | PTE_BLOCK_UXN 39 PTE_BLOCK_PXN | PTE_BLOCK_UXN
40 }, { 40 }, {
41 .virt = 0x400000000UL, 41 .virt = 0x400000000UL,
42 .phys = 0x400000000UL, 42 .phys = 0x400000000UL,
43 .size = 0x200000000UL, 43 .size = 0x200000000UL,
44 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | 44 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
45 PTE_BLOCK_NON_SHARE | 45 PTE_BLOCK_NON_SHARE |
46 PTE_BLOCK_PXN | PTE_BLOCK_UXN 46 PTE_BLOCK_PXN | PTE_BLOCK_UXN
47 }, { 47 }, {
48 .virt = 0x600000000UL, 48 .virt = 0x600000000UL,
49 .phys = 0x600000000UL, 49 .phys = 0x600000000UL,
50 .size = 0x800000000UL, 50 .size = 0x800000000UL,
51 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | 51 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
52 PTE_BLOCK_INNER_SHARE 52 PTE_BLOCK_INNER_SHARE
53 }, { 53 }, {
54 .virt = 0xe00000000UL, 54 .virt = 0xe00000000UL,
55 .phys = 0xe00000000UL, 55 .phys = 0xe00000000UL,
56 .size = 0xf200000000UL, 56 .size = 0xf200000000UL,
57 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | 57 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
58 PTE_BLOCK_NON_SHARE | 58 PTE_BLOCK_NON_SHARE |
59 PTE_BLOCK_PXN | PTE_BLOCK_UXN 59 PTE_BLOCK_PXN | PTE_BLOCK_UXN
60 }, { 60 }, {
61 /* List terminator */ 61 /* List terminator */
62 0, 62 0,
63 } 63 }
64 }; 64 };
65 struct mm_region *mem_map = zynqmp_mem_map; 65 struct mm_region *mem_map = zynqmp_mem_map;
66 66
67 u64 get_page_table_size(void) 67 u64 get_page_table_size(void)
68 { 68 {
69 return 0x14000; 69 return 0x14000;
70 } 70 }
71 71
72 static unsigned int zynqmp_get_silicon_version_secure(void) 72 static unsigned int zynqmp_get_silicon_version_secure(void)
73 { 73 {
74 u32 ver; 74 u32 ver;
75 75
76 ver = readl(&csu_base->version); 76 ver = readl(&csu_base->version);
77 ver &= ZYNQMP_SILICON_VER_MASK; 77 ver &= ZYNQMP_SILICON_VER_MASK;
78 ver >>= ZYNQMP_SILICON_VER_SHIFT; 78 ver >>= ZYNQMP_SILICON_VER_SHIFT;
79 79
80 return ver; 80 return ver;
81 } 81 }
82 82
83 unsigned int zynqmp_get_silicon_version(void) 83 unsigned int zynqmp_get_silicon_version(void)
84 { 84 {
85 if (current_el() == 3) 85 if (current_el() == 3)
86 return zynqmp_get_silicon_version_secure(); 86 return zynqmp_get_silicon_version_secure();
87 87
88 gd->cpu_clk = get_tbclk(); 88 gd->cpu_clk = get_tbclk();
89 89
90 switch (gd->cpu_clk) { 90 switch (gd->cpu_clk) {
91 case 0 ... 1000000: 91 case 0 ... 1000000:
92 return ZYNQMP_CSU_VERSION_VELOCE; 92 return ZYNQMP_CSU_VERSION_VELOCE;
93 case 50000000: 93 case 50000000:
94 return ZYNQMP_CSU_VERSION_QEMU; 94 return ZYNQMP_CSU_VERSION_QEMU;
95 case 4000000: 95 case 4000000:
96 return ZYNQMP_CSU_VERSION_EP108; 96 return ZYNQMP_CSU_VERSION_EP108;
97 } 97 }
98 98
99 return ZYNQMP_CSU_VERSION_SILICON; 99 return ZYNQMP_CSU_VERSION_SILICON;
100 } 100 }
101 101
102 #define ZYNQMP_MMIO_READ 0xC2000014 102 #define ZYNQMP_MMIO_READ 0xC2000014
103 #define ZYNQMP_MMIO_WRITE 0xC2000013 103 #define ZYNQMP_MMIO_WRITE 0xC2000013
104 104
105 #ifndef CONFIG_SPL_BUILD 105 #ifndef CONFIG_SPL_BUILD
106 int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, 106 int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3,
107 u32 *ret_payload) 107 u32 *ret_payload)
108 { 108 {
109 /* 109 /*
110 * Added SIP service call Function Identifier 110 * Added SIP service call Function Identifier
111 * Make sure to stay in x0 register 111 * Make sure to stay in x0 register
112 */ 112 */
113 struct pt_regs regs; 113 struct pt_regs regs;
114 114
115 regs.regs[0] = pm_api_id; 115 regs.regs[0] = pm_api_id;
116 regs.regs[1] = ((u64)arg1 << 32) | arg0; 116 regs.regs[1] = ((u64)arg1 << 32) | arg0;
117 regs.regs[2] = ((u64)arg3 << 32) | arg2; 117 regs.regs[2] = ((u64)arg3 << 32) | arg2;
118 118
119 smc_call(&regs); 119 smc_call(&regs);
120 120
121 if (ret_payload != NULL) { 121 if (ret_payload != NULL) {
122 ret_payload[0] = (u32)regs.regs[0]; 122 ret_payload[0] = (u32)regs.regs[0];
123 ret_payload[1] = upper_32_bits(regs.regs[0]); 123 ret_payload[1] = upper_32_bits(regs.regs[0]);
124 ret_payload[2] = (u32)regs.regs[1]; 124 ret_payload[2] = (u32)regs.regs[1];
125 ret_payload[3] = upper_32_bits(regs.regs[1]); 125 ret_payload[3] = upper_32_bits(regs.regs[1]);
126 ret_payload[4] = (u32)regs.regs[2]; 126 ret_payload[4] = (u32)regs.regs[2];
127 } 127 }
128 128
129 return regs.regs[0]; 129 return regs.regs[0];
130 } 130 }
131 131
132 #define ZYNQMP_SIP_SVC_GET_API_VERSION 0xC2000001
133
134 #define ZYNQMP_PM_VERSION_MAJOR 0
135 #define ZYNQMP_PM_VERSION_MINOR 3
136 #define ZYNQMP_PM_VERSION_MAJOR_SHIFT 16
137 #define ZYNQMP_PM_VERSION_MINOR_MASK 0xFFFF
138
139 #define ZYNQMP_PM_VERSION \
140 ((ZYNQMP_PM_VERSION_MAJOR << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | \
141 ZYNQMP_PM_VERSION_MINOR)
142
143 #if defined(CONFIG_CLK_ZYNQMP)
144 void zynqmp_pmufw_version(void)
145 {
146 int ret;
147 u32 ret_payload[PAYLOAD_ARG_CNT];
148 u32 pm_api_version;
149
150 ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0, 0, 0,
151 ret_payload);
152 pm_api_version = ret_payload[1];
153
154 if (ret)
155 panic("PMUFW is not found - Please load it!\n");
156
157 printf("PMUFW:\tv%d.%d\n",
158 pm_api_version >> ZYNQMP_PM_VERSION_MAJOR_SHIFT,
159 pm_api_version & ZYNQMP_PM_VERSION_MINOR_MASK);
160
161 if (pm_api_version != ZYNQMP_PM_VERSION)
162 panic("PMUFW version error. Expected: v%d.%d\n",
163 ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR);
164 }
165 #endif
166
132 int zynqmp_mmio_write(const u32 address, 167 int zynqmp_mmio_write(const u32 address,
133 const u32 mask, 168 const u32 mask,
134 const u32 value) 169 const u32 value)
135 { 170 {
136 return invoke_smc(ZYNQMP_MMIO_WRITE, address, mask, value, 0, NULL); 171 return invoke_smc(ZYNQMP_MMIO_WRITE, address, mask, value, 0, NULL);
137 } 172 }
138 173
139 int zynqmp_mmio_read(const u32 address, u32 *value) 174 int zynqmp_mmio_read(const u32 address, u32 *value)
140 { 175 {
141 u32 ret_payload[PAYLOAD_ARG_CNT]; 176 u32 ret_payload[PAYLOAD_ARG_CNT];
142 u32 ret; 177 u32 ret;
143 178
144 if (!value) 179 if (!value)
145 return -EINVAL; 180 return -EINVAL;
146 181
147 ret = invoke_smc(ZYNQMP_MMIO_READ, address, 0, 0, 0, ret_payload); 182 ret = invoke_smc(ZYNQMP_MMIO_READ, address, 0, 0, 0, ret_payload);
148 *value = ret_payload[1]; 183 *value = ret_payload[1];
149 184
150 return ret; 185 return ret;
151 } 186 }
152 #else 187 #else
153 int zynqmp_mmio_write(const u32 address, 188 int zynqmp_mmio_write(const u32 address,
154 const u32 mask, 189 const u32 mask,
155 const u32 value) 190 const u32 value)
156 { 191 {
157 u32 data; 192 u32 data;
158 u32 value_local = value; 193 u32 value_local = value;
159 194
160 zynqmp_mmio_read(address, &data); 195 zynqmp_mmio_read(address, &data);
161 data &= ~mask; 196 data &= ~mask;
162 value_local &= mask; 197 value_local &= mask;
163 value_local |= data; 198 value_local |= data;
164 writel(value_local, (ulong)address); 199 writel(value_local, (ulong)address);
165 return 0; 200 return 0;
166 } 201 }
167 202
168 int zynqmp_mmio_read(const u32 address, u32 *value) 203 int zynqmp_mmio_read(const u32 address, u32 *value)
169 { 204 {
170 *value = readl((ulong)address); 205 *value = readl((ulong)address);
171 return 0; 206 return 0;
172 } 207 }
173 #endif 208 #endif
174 209
arch/arm/include/asm/arch-zynqmp/sys_proto.h
1 /* 1 /*
2 * (C) Copyright 2014 - 2015 Xilinx, Inc. 2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com> 3 * Michal Simek <michal.simek@xilinx.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #ifndef _ASM_ARCH_SYS_PROTO_H 8 #ifndef _ASM_ARCH_SYS_PROTO_H
9 #define _ASM_ARCH_SYS_PROTO_H 9 #define _ASM_ARCH_SYS_PROTO_H
10 10
11 #define PAYLOAD_ARG_CNT 5 11 #define PAYLOAD_ARG_CNT 5
12 12
13 int zynq_slcr_get_mio_pin_status(const char *periph); 13 int zynq_slcr_get_mio_pin_status(const char *periph);
14 14
15 unsigned int zynqmp_get_silicon_version(void); 15 unsigned int zynqmp_get_silicon_version(void);
16 16
17 void psu_init(void); 17 void psu_init(void);
18 18
19 void handoff_setup(void); 19 void handoff_setup(void);
20 20
21 void zynqmp_pmufw_version(void);
21 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); 22 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
22 int zynqmp_mmio_read(const u32 address, u32 *value); 23 int zynqmp_mmio_read(const u32 address, u32 *value);
23 int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, 24 int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3,
24 u32 *ret_payload); 25 u32 *ret_payload);
25 26
26 #endif /* _ASM_ARCH_SYS_PROTO_H */ 27 #endif /* _ASM_ARCH_SYS_PROTO_H */
27 28
board/xilinx/zynqmp/zynqmp.c
1 /* 1 /*
2 * (C) Copyright 2014 - 2015 Xilinx, Inc. 2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com> 3 * Michal Simek <michal.simek@xilinx.com>
4 * 4 *
5 * SPDX-License-Identifier: GPL-2.0+ 5 * SPDX-License-Identifier: GPL-2.0+
6 */ 6 */
7 7
8 #include <common.h> 8 #include <common.h>
9 #include <sata.h> 9 #include <sata.h>
10 #include <ahci.h> 10 #include <ahci.h>
11 #include <scsi.h> 11 #include <scsi.h>
12 #include <malloc.h> 12 #include <malloc.h>
13 #include <asm/arch/clk.h> 13 #include <asm/arch/clk.h>
14 #include <asm/arch/hardware.h> 14 #include <asm/arch/hardware.h>
15 #include <asm/arch/sys_proto.h> 15 #include <asm/arch/sys_proto.h>
16 #include <asm/io.h> 16 #include <asm/io.h>
17 #include <usb.h> 17 #include <usb.h>
18 #include <dwc3-uboot.h> 18 #include <dwc3-uboot.h>
19 #include <zynqmppl.h> 19 #include <zynqmppl.h>
20 #include <i2c.h> 20 #include <i2c.h>
21 #include <g_dnl.h> 21 #include <g_dnl.h>
22 22
23 DECLARE_GLOBAL_DATA_PTR; 23 DECLARE_GLOBAL_DATA_PTR;
24 24
25 #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ 25 #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
26 !defined(CONFIG_SPL_BUILD) 26 !defined(CONFIG_SPL_BUILD)
27 static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC; 27 static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC;
28 28
29 static const struct { 29 static const struct {
30 uint32_t id; 30 uint32_t id;
31 char *name; 31 char *name;
32 } zynqmp_devices[] = { 32 } zynqmp_devices[] = {
33 { 33 {
34 .id = 0x10, 34 .id = 0x10,
35 .name = "3eg", 35 .name = "3eg",
36 }, 36 },
37 { 37 {
38 .id = 0x11, 38 .id = 0x11,
39 .name = "2eg", 39 .name = "2eg",
40 }, 40 },
41 { 41 {
42 .id = 0x20, 42 .id = 0x20,
43 .name = "5ev", 43 .name = "5ev",
44 }, 44 },
45 { 45 {
46 .id = 0x21, 46 .id = 0x21,
47 .name = "4ev", 47 .name = "4ev",
48 }, 48 },
49 { 49 {
50 .id = 0x30, 50 .id = 0x30,
51 .name = "7ev", 51 .name = "7ev",
52 }, 52 },
53 { 53 {
54 .id = 0x38, 54 .id = 0x38,
55 .name = "9eg", 55 .name = "9eg",
56 }, 56 },
57 { 57 {
58 .id = 0x39, 58 .id = 0x39,
59 .name = "6eg", 59 .name = "6eg",
60 }, 60 },
61 { 61 {
62 .id = 0x40, 62 .id = 0x40,
63 .name = "11eg", 63 .name = "11eg",
64 }, 64 },
65 { 65 {
66 .id = 0x50, 66 .id = 0x50,
67 .name = "15eg", 67 .name = "15eg",
68 }, 68 },
69 { 69 {
70 .id = 0x58, 70 .id = 0x58,
71 .name = "19eg", 71 .name = "19eg",
72 }, 72 },
73 { 73 {
74 .id = 0x59, 74 .id = 0x59,
75 .name = "17eg", 75 .name = "17eg",
76 }, 76 },
77 }; 77 };
78 78
79 static int chip_id(void) 79 static int chip_id(void)
80 { 80 {
81 struct pt_regs regs; 81 struct pt_regs regs;
82 regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID; 82 regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID;
83 regs.regs[1] = 0; 83 regs.regs[1] = 0;
84 regs.regs[2] = 0; 84 regs.regs[2] = 0;
85 regs.regs[3] = 0; 85 regs.regs[3] = 0;
86 86
87 smc_call(&regs); 87 smc_call(&regs);
88 88
89 /* 89 /*
90 * SMC returns: 90 * SMC returns:
91 * regs[0][31:0] = status of the operation 91 * regs[0][31:0] = status of the operation
92 * regs[0][63:32] = CSU.IDCODE register 92 * regs[0][63:32] = CSU.IDCODE register
93 * regs[1][31:0] = CSU.version register 93 * regs[1][31:0] = CSU.version register
94 */ 94 */
95 regs.regs[0] = upper_32_bits(regs.regs[0]); 95 regs.regs[0] = upper_32_bits(regs.regs[0]);
96 regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | 96 regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
97 ZYNQMP_CSU_IDCODE_SVD_MASK; 97 ZYNQMP_CSU_IDCODE_SVD_MASK;
98 regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT; 98 regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
99 99
100 return regs.regs[0]; 100 return regs.regs[0];
101 } 101 }
102 102
103 static char *zynqmp_get_silicon_idcode_name(void) 103 static char *zynqmp_get_silicon_idcode_name(void)
104 { 104 {
105 uint32_t i, id; 105 uint32_t i, id;
106 106
107 id = chip_id(); 107 id = chip_id();
108 for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { 108 for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) {
109 if (zynqmp_devices[i].id == id) 109 if (zynqmp_devices[i].id == id)
110 return zynqmp_devices[i].name; 110 return zynqmp_devices[i].name;
111 } 111 }
112 return "unknown"; 112 return "unknown";
113 } 113 }
114 #endif 114 #endif
115 115
116 int board_early_init_f(void)
117 {
118 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP)
119 zynqmp_pmufw_version();
120 #endif
121 return 0;
122 }
123
116 #define ZYNQMP_VERSION_SIZE 9 124 #define ZYNQMP_VERSION_SIZE 9
117 125
118 int board_init(void) 126 int board_init(void)
119 { 127 {
120 printf("EL Level:\tEL%d\n", current_el()); 128 printf("EL Level:\tEL%d\n", current_el());
121 129
122 #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ 130 #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
123 !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \ 131 !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \
124 defined(CONFIG_SPL_BUILD)) 132 defined(CONFIG_SPL_BUILD))
125 if (current_el() != 3) { 133 if (current_el() != 3) {
126 static char version[ZYNQMP_VERSION_SIZE]; 134 static char version[ZYNQMP_VERSION_SIZE];
127 135
128 strncat(version, "xczu", ZYNQMP_VERSION_SIZE); 136 strncat(version, "xczu", ZYNQMP_VERSION_SIZE);
129 zynqmppl.name = strncat(version, 137 zynqmppl.name = strncat(version,
130 zynqmp_get_silicon_idcode_name(), 138 zynqmp_get_silicon_idcode_name(),
131 ZYNQMP_VERSION_SIZE); 139 ZYNQMP_VERSION_SIZE);
132 printf("Chip ID:\t%s\n", zynqmppl.name); 140 printf("Chip ID:\t%s\n", zynqmppl.name);
133 fpga_init(); 141 fpga_init();
134 fpga_add(fpga_xilinx, &zynqmppl); 142 fpga_add(fpga_xilinx, &zynqmppl);
135 } 143 }
136 #endif 144 #endif
137 145
138 return 0; 146 return 0;
139 } 147 }
140 148
141 int board_early_init_r(void) 149 int board_early_init_r(void)
142 { 150 {
143 u32 val; 151 u32 val;
144 152
145 if (current_el() == 3) { 153 if (current_el() == 3) {
146 val = readl(&crlapb_base->timestamp_ref_ctrl); 154 val = readl(&crlapb_base->timestamp_ref_ctrl);
147 val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; 155 val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
148 writel(val, &crlapb_base->timestamp_ref_ctrl); 156 writel(val, &crlapb_base->timestamp_ref_ctrl);
149 157
150 /* Program freq register in System counter */ 158 /* Program freq register in System counter */
151 writel(zynqmp_get_system_timer_freq(), 159 writel(zynqmp_get_system_timer_freq(),
152 &iou_scntr_secure->base_frequency_id_register); 160 &iou_scntr_secure->base_frequency_id_register);
153 /* And enable system counter */ 161 /* And enable system counter */
154 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN, 162 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
155 &iou_scntr_secure->counter_control_register); 163 &iou_scntr_secure->counter_control_register);
156 } 164 }
157 /* Program freq register in System counter and enable system counter */ 165 /* Program freq register in System counter and enable system counter */
158 writel(gd->cpu_clk, &iou_scntr->base_frequency_id_register); 166 writel(gd->cpu_clk, &iou_scntr->base_frequency_id_register);
159 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG | 167 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG |
160 ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN, 168 ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
161 &iou_scntr->counter_control_register); 169 &iou_scntr->counter_control_register);
162 170
163 return 0; 171 return 0;
164 } 172 }
165 173
166 int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) 174 int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
167 { 175 {
168 #if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \ 176 #if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \
169 defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) && \ 177 defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) && \
170 defined(CONFIG_ZYNQ_EEPROM_BUS) 178 defined(CONFIG_ZYNQ_EEPROM_BUS)
171 i2c_set_bus_num(CONFIG_ZYNQ_EEPROM_BUS); 179 i2c_set_bus_num(CONFIG_ZYNQ_EEPROM_BUS);
172 180
173 if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR, 181 if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR,
174 CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET, 182 CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET,
175 ethaddr, 6)) 183 ethaddr, 6))
176 printf("I2C EEPROM MAC address read failed\n"); 184 printf("I2C EEPROM MAC address read failed\n");
177 #endif 185 #endif
178 186
179 return 0; 187 return 0;
180 } 188 }
181 189
182 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE) 190 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
183 int dram_init_banksize(void) 191 int dram_init_banksize(void)
184 { 192 {
185 fdtdec_setup_memory_banksize(); 193 fdtdec_setup_memory_banksize();
186 194
187 return 0; 195 return 0;
188 } 196 }
189 197
190 int dram_init(void) 198 int dram_init(void)
191 { 199 {
192 if (fdtdec_setup_memory_size() != 0) 200 if (fdtdec_setup_memory_size() != 0)
193 return -EINVAL; 201 return -EINVAL;
194 202
195 return 0; 203 return 0;
196 } 204 }
197 #else 205 #else
198 int dram_init(void) 206 int dram_init(void)
199 { 207 {
200 gd->ram_size = CONFIG_SYS_SDRAM_SIZE; 208 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
201 209
202 return 0; 210 return 0;
203 } 211 }
204 #endif 212 #endif
205 213
206 void reset_cpu(ulong addr) 214 void reset_cpu(ulong addr)
207 { 215 {
208 } 216 }
209 217
210 int board_late_init(void) 218 int board_late_init(void)
211 { 219 {
212 u32 reg = 0; 220 u32 reg = 0;
213 u8 bootmode; 221 u8 bootmode;
214 const char *mode; 222 const char *mode;
215 char *new_targets; 223 char *new_targets;
216 224
217 if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { 225 if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
218 debug("Saved variables - Skipping\n"); 226 debug("Saved variables - Skipping\n");
219 return 0; 227 return 0;
220 } 228 }
221 229
222 reg = readl(&crlapb_base->boot_mode); 230 reg = readl(&crlapb_base->boot_mode);
223 if (reg >> BOOT_MODE_ALT_SHIFT) 231 if (reg >> BOOT_MODE_ALT_SHIFT)
224 reg >>= BOOT_MODE_ALT_SHIFT; 232 reg >>= BOOT_MODE_ALT_SHIFT;
225 233
226 bootmode = reg & BOOT_MODES_MASK; 234 bootmode = reg & BOOT_MODES_MASK;
227 235
228 puts("Bootmode: "); 236 puts("Bootmode: ");
229 switch (bootmode) { 237 switch (bootmode) {
230 case USB_MODE: 238 case USB_MODE:
231 puts("USB_MODE\n"); 239 puts("USB_MODE\n");
232 mode = "usb"; 240 mode = "usb";
233 break; 241 break;
234 case JTAG_MODE: 242 case JTAG_MODE:
235 puts("JTAG_MODE\n"); 243 puts("JTAG_MODE\n");
236 mode = "pxe dhcp"; 244 mode = "pxe dhcp";
237 break; 245 break;
238 case QSPI_MODE_24BIT: 246 case QSPI_MODE_24BIT:
239 case QSPI_MODE_32BIT: 247 case QSPI_MODE_32BIT:
240 mode = "qspi0"; 248 mode = "qspi0";
241 puts("QSPI_MODE\n"); 249 puts("QSPI_MODE\n");
242 break; 250 break;
243 case EMMC_MODE: 251 case EMMC_MODE:
244 puts("EMMC_MODE\n"); 252 puts("EMMC_MODE\n");
245 mode = "mmc0"; 253 mode = "mmc0";
246 break; 254 break;
247 case SD_MODE: 255 case SD_MODE:
248 puts("SD_MODE\n"); 256 puts("SD_MODE\n");
249 mode = "mmc0"; 257 mode = "mmc0";
250 break; 258 break;
251 case SD1_LSHFT_MODE: 259 case SD1_LSHFT_MODE:
252 puts("LVL_SHFT_"); 260 puts("LVL_SHFT_");
253 /* fall through */ 261 /* fall through */
254 case SD_MODE1: 262 case SD_MODE1:
255 puts("SD_MODE1\n"); 263 puts("SD_MODE1\n");
256 #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1) 264 #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
257 mode = "mmc1"; 265 mode = "mmc1";
258 #else 266 #else
259 mode = "mmc0"; 267 mode = "mmc0";
260 #endif 268 #endif
261 break; 269 break;
262 case NAND_MODE: 270 case NAND_MODE:
263 puts("NAND_MODE\n"); 271 puts("NAND_MODE\n");
264 mode = "nand0"; 272 mode = "nand0";
265 break; 273 break;
266 default: 274 default:
267 mode = ""; 275 mode = "";
268 printf("Invalid Boot Mode:0x%x\n", bootmode); 276 printf("Invalid Boot Mode:0x%x\n", bootmode);
269 break; 277 break;
270 } 278 }
271 279
272 /* 280 /*
273 * One terminating char + one byte for space between mode 281 * One terminating char + one byte for space between mode
274 * and default boot_targets 282 * and default boot_targets
275 */ 283 */
276 new_targets = calloc(1, strlen(mode) + 284 new_targets = calloc(1, strlen(mode) +
277 strlen(getenv("boot_targets")) + 2); 285 strlen(getenv("boot_targets")) + 2);
278 286
279 sprintf(new_targets, "%s %s", mode, getenv("boot_targets")); 287 sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
280 setenv("boot_targets", new_targets); 288 setenv("boot_targets", new_targets);
281 289
282 return 0; 290 return 0;
283 } 291 }
284 292
285 int checkboard(void) 293 int checkboard(void)
286 { 294 {
287 puts("Board: Xilinx ZynqMP\n"); 295 puts("Board: Xilinx ZynqMP\n");
288 return 0; 296 return 0;
289 } 297 }
290 298
291 #ifdef CONFIG_USB_DWC3 299 #ifdef CONFIG_USB_DWC3
292 static struct dwc3_device dwc3_device_data0 = { 300 static struct dwc3_device dwc3_device_data0 = {
293 .maximum_speed = USB_SPEED_HIGH, 301 .maximum_speed = USB_SPEED_HIGH,
294 .base = ZYNQMP_USB0_XHCI_BASEADDR, 302 .base = ZYNQMP_USB0_XHCI_BASEADDR,
295 .dr_mode = USB_DR_MODE_PERIPHERAL, 303 .dr_mode = USB_DR_MODE_PERIPHERAL,
296 .index = 0, 304 .index = 0,
297 }; 305 };
298 306
299 static struct dwc3_device dwc3_device_data1 = { 307 static struct dwc3_device dwc3_device_data1 = {
300 .maximum_speed = USB_SPEED_HIGH, 308 .maximum_speed = USB_SPEED_HIGH,
301 .base = ZYNQMP_USB1_XHCI_BASEADDR, 309 .base = ZYNQMP_USB1_XHCI_BASEADDR,
302 .dr_mode = USB_DR_MODE_PERIPHERAL, 310 .dr_mode = USB_DR_MODE_PERIPHERAL,
303 .index = 1, 311 .index = 1,
304 }; 312 };
305 313
306 int usb_gadget_handle_interrupts(int index) 314 int usb_gadget_handle_interrupts(int index)
307 { 315 {
308 dwc3_uboot_handle_interrupt(index); 316 dwc3_uboot_handle_interrupt(index);
309 return 0; 317 return 0;
310 } 318 }
311 319
312 int board_usb_init(int index, enum usb_init_type init) 320 int board_usb_init(int index, enum usb_init_type init)
313 { 321 {
314 debug("%s: index %x\n", __func__, index); 322 debug("%s: index %x\n", __func__, index);
315 323
316 #if defined(CONFIG_USB_GADGET_DOWNLOAD) 324 #if defined(CONFIG_USB_GADGET_DOWNLOAD)
317 g_dnl_set_serialnumber(CONFIG_SYS_CONFIG_NAME); 325 g_dnl_set_serialnumber(CONFIG_SYS_CONFIG_NAME);
318 #endif 326 #endif
319 327
320 switch (index) { 328 switch (index) {
321 case 0: 329 case 0:
322 return dwc3_uboot_init(&dwc3_device_data0); 330 return dwc3_uboot_init(&dwc3_device_data0);
323 case 1: 331 case 1:
324 return dwc3_uboot_init(&dwc3_device_data1); 332 return dwc3_uboot_init(&dwc3_device_data1);
325 }; 333 };
326 334
327 return -1; 335 return -1;
328 } 336 }
329 337
330 int board_usb_cleanup(int index, enum usb_init_type init) 338 int board_usb_cleanup(int index, enum usb_init_type init)
331 { 339 {
332 dwc3_uboot_exit(index); 340 dwc3_uboot_exit(index);
333 return 0; 341 return 0;
334 } 342 }
335 #endif 343 #endif
336 344
include/configs/xilinx_zynqmp.h
1 /* 1 /*
2 * Configuration for Xilinx ZynqMP 2 * Configuration for Xilinx ZynqMP
3 * (C) Copyright 2014 - 2015 Xilinx, Inc. 3 * (C) Copyright 2014 - 2015 Xilinx, Inc.
4 * Michal Simek <michal.simek@xilinx.com> 4 * Michal Simek <michal.simek@xilinx.com>
5 * 5 *
6 * Based on Configuration for Versatile Express 6 * Based on Configuration for Versatile Express
7 * 7 *
8 * SPDX-License-Identifier: GPL-2.0+ 8 * SPDX-License-Identifier: GPL-2.0+
9 */ 9 */
10 10
11 #ifndef __XILINX_ZYNQMP_H 11 #ifndef __XILINX_ZYNQMP_H
12 #define __XILINX_ZYNQMP_H 12 #define __XILINX_ZYNQMP_H
13 13
14 #define CONFIG_REMAKE_ELF 14 #define CONFIG_REMAKE_ELF
15 15
16 /* #define CONFIG_ARMV8_SWITCH_TO_EL1 */ 16 /* #define CONFIG_ARMV8_SWITCH_TO_EL1 */
17 17
18 /* Generic Interrupt Controller Definitions */ 18 /* Generic Interrupt Controller Definitions */
19 #define CONFIG_GICV2 19 #define CONFIG_GICV2
20 #define GICD_BASE 0xF9010000 20 #define GICD_BASE 0xF9010000
21 #define GICC_BASE 0xF9020000 21 #define GICC_BASE 0xF9020000
22 22
23 #define CONFIG_SYS_ALT_MEMTEST 23 #define CONFIG_SYS_ALT_MEMTEST
24 #define CONFIG_SYS_MEMTEST_SCRATCH 0xfffc0000 24 #define CONFIG_SYS_MEMTEST_SCRATCH 0xfffc0000
25 25
26 #ifndef CONFIG_NR_DRAM_BANKS 26 #ifndef CONFIG_NR_DRAM_BANKS
27 # define CONFIG_NR_DRAM_BANKS 2 27 # define CONFIG_NR_DRAM_BANKS 2
28 #endif 28 #endif
29 #define CONFIG_SYS_MEMTEST_START 0 29 #define CONFIG_SYS_MEMTEST_START 0
30 #define CONFIG_SYS_MEMTEST_END 1000 30 #define CONFIG_SYS_MEMTEST_END 1000
31 31
32 #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE 32 #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
33 33
34 /* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */ 34 /* Generic Timer Definitions - setup in EL3. Setup by ATF for other cases */
35 #if !defined(COUNTER_FREQUENCY) 35 #if !defined(COUNTER_FREQUENCY)
36 # define COUNTER_FREQUENCY 100000000 36 # define COUNTER_FREQUENCY 100000000
37 #endif 37 #endif
38 38
39 /* Size of malloc() pool */ 39 /* Size of malloc() pool */
40 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x2000000) 40 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x2000000)
41 41
42 /* Serial setup */ 42 /* Serial setup */
43 #define CONFIG_ARM_DCC 43 #define CONFIG_ARM_DCC
44 #define CONFIG_CPU_ARMV8 44 #define CONFIG_CPU_ARMV8
45 #define CONFIG_ZYNQ_SERIAL 45 #define CONFIG_ZYNQ_SERIAL
46 46
47 #define CONFIG_CONS_INDEX 0 47 #define CONFIG_CONS_INDEX 0
48 #define CONFIG_SYS_BAUDRATE_TABLE \ 48 #define CONFIG_SYS_BAUDRATE_TABLE \
49 { 4800, 9600, 19200, 38400, 57600, 115200 } 49 { 4800, 9600, 19200, 38400, 57600, 115200 }
50 50
51 /* Command line configuration */ 51 /* Command line configuration */
52 #define CONFIG_MP 52 #define CONFIG_MP
53 53
54 /* BOOTP options */ 54 /* BOOTP options */
55 #define CONFIG_BOOTP_BOOTFILESIZE 55 #define CONFIG_BOOTP_BOOTFILESIZE
56 #define CONFIG_BOOTP_BOOTPATH 56 #define CONFIG_BOOTP_BOOTPATH
57 #define CONFIG_BOOTP_GATEWAY 57 #define CONFIG_BOOTP_GATEWAY
58 #define CONFIG_BOOTP_HOSTNAME 58 #define CONFIG_BOOTP_HOSTNAME
59 #define CONFIG_BOOTP_MAY_FAIL 59 #define CONFIG_BOOTP_MAY_FAIL
60 #define CONFIG_BOOTP_DNS 60 #define CONFIG_BOOTP_DNS
61 #define CONFIG_BOOTP_PXE 61 #define CONFIG_BOOTP_PXE
62 #define CONFIG_BOOTP_SUBNETMASK 62 #define CONFIG_BOOTP_SUBNETMASK
63 63
64 /* Diff from config_distro_defaults.h */ 64 /* Diff from config_distro_defaults.h */
65 #define CONFIG_SUPPORT_RAW_INITRD 65 #define CONFIG_SUPPORT_RAW_INITRD
66 #if !defined(CONFIG_SPL_BUILD) 66 #if !defined(CONFIG_SPL_BUILD)
67 #define CONFIG_ENV_VARS_UBOOT_CONFIG 67 #define CONFIG_ENV_VARS_UBOOT_CONFIG
68 #endif 68 #endif
69 #define CONFIG_AUTO_COMPLETE 69 #define CONFIG_AUTO_COMPLETE
70 70
71 #if defined(CONFIG_MMC_SDHCI_ZYNQ) 71 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
72 # define CONFIG_SUPPORT_EMMC_BOOT 72 # define CONFIG_SUPPORT_EMMC_BOOT
73 # ifndef CONFIG_ZYNQ_SDHCI_MAX_FREQ 73 # ifndef CONFIG_ZYNQ_SDHCI_MAX_FREQ
74 # define CONFIG_ZYNQ_SDHCI_MAX_FREQ 200000000 74 # define CONFIG_ZYNQ_SDHCI_MAX_FREQ 200000000
75 # endif 75 # endif
76 # define CONFIG_ENV_IS_IN_FAT 76 # define CONFIG_ENV_IS_IN_FAT
77 # define FAT_ENV_DEVICE_AND_PART "0:auto" 77 # define FAT_ENV_DEVICE_AND_PART "0:auto"
78 # define FAT_ENV_FILE "uboot.env" 78 # define FAT_ENV_FILE "uboot.env"
79 # define FAT_ENV_INTERFACE "mmc" 79 # define FAT_ENV_INTERFACE "mmc"
80 #endif 80 #endif
81 81
82 #ifdef CONFIG_NAND_ARASAN 82 #ifdef CONFIG_NAND_ARASAN
83 # define CONFIG_CMD_NAND_LOCK_UNLOCK 83 # define CONFIG_CMD_NAND_LOCK_UNLOCK
84 # define CONFIG_SYS_MAX_NAND_DEVICE 1 84 # define CONFIG_SYS_MAX_NAND_DEVICE 1
85 # define CONFIG_SYS_NAND_SELF_INIT 85 # define CONFIG_SYS_NAND_SELF_INIT
86 # define CONFIG_SYS_NAND_ONFI_DETECTION 86 # define CONFIG_SYS_NAND_ONFI_DETECTION
87 # define CONFIG_MTD_DEVICE 87 # define CONFIG_MTD_DEVICE
88 #endif 88 #endif
89 89
90 /* Miscellaneous configurable options */ 90 /* Miscellaneous configurable options */
91 #define CONFIG_SYS_LOAD_ADDR 0x8000000 91 #define CONFIG_SYS_LOAD_ADDR 0x8000000
92 92
93 #if defined(CONFIG_ZYNQMP_USB) 93 #if defined(CONFIG_ZYNQMP_USB)
94 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2 94 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
95 95
96 #define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x1800000 96 #define CONFIG_SYS_DFU_DATA_BUF_SIZE 0x1800000
97 #define DFU_DEFAULT_POLL_TIMEOUT 300 97 #define DFU_DEFAULT_POLL_TIMEOUT 300
98 #define CONFIG_USB_CABLE_CHECK 98 #define CONFIG_USB_CABLE_CHECK
99 #define CONFIG_CMD_THOR_DOWNLOAD 99 #define CONFIG_CMD_THOR_DOWNLOAD
100 #define CONFIG_USB_FUNCTION_THOR 100 #define CONFIG_USB_FUNCTION_THOR
101 #define CONFIG_THOR_RESET_OFF 101 #define CONFIG_THOR_RESET_OFF
102 #define DFU_ALT_INFO_RAM \ 102 #define DFU_ALT_INFO_RAM \
103 "dfu_ram_info=" \ 103 "dfu_ram_info=" \
104 "setenv dfu_alt_info " \ 104 "setenv dfu_alt_info " \
105 "Image ram $kernel_addr $kernel_size\\\\;" \ 105 "Image ram $kernel_addr $kernel_size\\\\;" \
106 "system.dtb ram $fdt_addr $fdt_size\0" \ 106 "system.dtb ram $fdt_addr $fdt_size\0" \
107 "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \ 107 "dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
108 "thor_ram=run dfu_ram_info && thordown 0 ram 0\0" 108 "thor_ram=run dfu_ram_info && thordown 0 ram 0\0"
109 109
110 #define DFU_ALT_INFO \ 110 #define DFU_ALT_INFO \
111 DFU_ALT_INFO_RAM 111 DFU_ALT_INFO_RAM
112 112
113 #ifndef CONFIG_SPL_BUILD 113 #ifndef CONFIG_SPL_BUILD
114 # define CONFIG_USB_FUNCTION_FASTBOOT 114 # define CONFIG_USB_FUNCTION_FASTBOOT
115 # define CONFIG_CMD_FASTBOOT 115 # define CONFIG_CMD_FASTBOOT
116 # define CONFIG_ANDROID_BOOT_IMAGE 116 # define CONFIG_ANDROID_BOOT_IMAGE
117 # define CONFIG_FASTBOOT_BUF_ADDR 0x100000 117 # define CONFIG_FASTBOOT_BUF_ADDR 0x100000
118 # define CONFIG_FASTBOOT_BUF_SIZE 0x6000000 118 # define CONFIG_FASTBOOT_BUF_SIZE 0x6000000
119 # define CONFIG_FASTBOOT_FLASH 119 # define CONFIG_FASTBOOT_FLASH
120 # ifdef CONFIG_MMC_SDHCI_ZYNQ 120 # ifdef CONFIG_MMC_SDHCI_ZYNQ
121 # define CONFIG_FASTBOOT_FLASH_MMC_DEV 0 121 # define CONFIG_FASTBOOT_FLASH_MMC_DEV 0
122 # endif 122 # endif
123 123
124 # define CONFIG_RANDOM_UUID 124 # define CONFIG_RANDOM_UUID
125 # define PARTS_DEFAULT \ 125 # define PARTS_DEFAULT \
126 "partitions=uuid_disk=${uuid_gpt_disk};" \ 126 "partitions=uuid_disk=${uuid_gpt_disk};" \
127 "name=""boot"",size=16M,uuid=${uuid_gpt_boot};" \ 127 "name=""boot"",size=16M,uuid=${uuid_gpt_boot};" \
128 "name=""Linux"",size=-M,uuid=${uuid_gpt_Linux}\0" 128 "name=""Linux"",size=-M,uuid=${uuid_gpt_Linux}\0"
129 #endif 129 #endif
130 #endif 130 #endif
131 131
132 #if !defined(DFU_ALT_INFO) 132 #if !defined(DFU_ALT_INFO)
133 # define DFU_ALT_INFO 133 # define DFU_ALT_INFO
134 #endif 134 #endif
135 135
136 #if !defined(PARTS_DEFAULT) 136 #if !defined(PARTS_DEFAULT)
137 # define PARTS_DEFAULT 137 # define PARTS_DEFAULT
138 #endif 138 #endif
139 139
140 /* Do not preserve environment */ 140 /* Do not preserve environment */
141 #if !defined(CONFIG_ENV_IS_IN_FAT) 141 #if !defined(CONFIG_ENV_IS_IN_FAT)
142 #define CONFIG_ENV_IS_NOWHERE 1 142 #define CONFIG_ENV_IS_NOWHERE 1
143 #endif 143 #endif
144 #define CONFIG_ENV_SIZE 0x8000 144 #define CONFIG_ENV_SIZE 0x8000
145 145
146 /* Monitor Command Prompt */ 146 /* Monitor Command Prompt */
147 /* Console I/O Buffer Size */ 147 /* Console I/O Buffer Size */
148 #define CONFIG_SYS_CBSIZE 2048 148 #define CONFIG_SYS_CBSIZE 2048
149 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ 149 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
150 sizeof(CONFIG_SYS_PROMPT) + 16) 150 sizeof(CONFIG_SYS_PROMPT) + 16)
151 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 151 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
152 #define CONFIG_SYS_LONGHELP 152 #define CONFIG_SYS_LONGHELP
153 #define CONFIG_CMDLINE_EDITING 153 #define CONFIG_CMDLINE_EDITING
154 #define CONFIG_SYS_MAXARGS 64 154 #define CONFIG_SYS_MAXARGS 64
155 155
156 /* Ethernet driver */ 156 /* Ethernet driver */
157 #if defined(CONFIG_ZYNQ_GEM) 157 #if defined(CONFIG_ZYNQ_GEM)
158 # define CONFIG_NET_MULTI 158 # define CONFIG_NET_MULTI
159 # define CONFIG_MII 159 # define CONFIG_MII
160 # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN 160 # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
161 # define CONFIG_PHY_MARVELL 161 # define CONFIG_PHY_MARVELL
162 # define CONFIG_PHY_NATSEMI 162 # define CONFIG_PHY_NATSEMI
163 # define CONFIG_PHY_TI 163 # define CONFIG_PHY_TI
164 # define CONFIG_PHY_GIGE 164 # define CONFIG_PHY_GIGE
165 # define CONFIG_PHY_VITESSE 165 # define CONFIG_PHY_VITESSE
166 # define CONFIG_PHY_REALTEK 166 # define CONFIG_PHY_REALTEK
167 # define PHY_ANEG_TIMEOUT 20000 167 # define PHY_ANEG_TIMEOUT 20000
168 #endif 168 #endif
169 169
170 /* I2C */ 170 /* I2C */
171 #if defined(CONFIG_SYS_I2C_ZYNQ) 171 #if defined(CONFIG_SYS_I2C_ZYNQ)
172 # define CONFIG_SYS_I2C 172 # define CONFIG_SYS_I2C
173 # define CONFIG_SYS_I2C_ZYNQ_SPEED 100000 173 # define CONFIG_SYS_I2C_ZYNQ_SPEED 100000
174 # define CONFIG_SYS_I2C_ZYNQ_SLAVE 0 174 # define CONFIG_SYS_I2C_ZYNQ_SLAVE 0
175 #endif 175 #endif
176 176
177 /* EEPROM */ 177 /* EEPROM */
178 #ifdef CONFIG_ZYNQMP_EEPROM 178 #ifdef CONFIG_ZYNQMP_EEPROM
179 # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 179 # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
180 # define CONFIG_SYS_I2C_EEPROM_ADDR 0x54 180 # define CONFIG_SYS_I2C_EEPROM_ADDR 0x54
181 # define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4 181 # define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
182 # define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 182 # define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
183 # define CONFIG_SYS_EEPROM_SIZE (64 * 1024) 183 # define CONFIG_SYS_EEPROM_SIZE (64 * 1024)
184 #endif 184 #endif
185 185
186 #ifdef CONFIG_SATA_CEVA 186 #ifdef CONFIG_SATA_CEVA
187 #define CONFIG_LIBATA 187 #define CONFIG_LIBATA
188 #define CONFIG_SCSI_AHCI 188 #define CONFIG_SCSI_AHCI
189 #define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 189 #define CONFIG_SYS_SCSI_MAX_SCSI_ID 2
190 #define CONFIG_SYS_SCSI_MAX_LUN 1 190 #define CONFIG_SYS_SCSI_MAX_LUN 1
191 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ 191 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
192 CONFIG_SYS_SCSI_MAX_LUN) 192 CONFIG_SYS_SCSI_MAX_LUN)
193 #define CONFIG_SCSI 193 #define CONFIG_SCSI
194 #endif 194 #endif
195 195
196 #define CONFIG_SYS_BOOTM_LEN (60 * 1024 * 1024) 196 #define CONFIG_SYS_BOOTM_LEN (60 * 1024 * 1024)
197 197
198 #define CONFIG_BOARD_EARLY_INIT_R 198 #define CONFIG_BOARD_EARLY_INIT_R
199 #define CONFIG_CLOCKS 199 #define CONFIG_CLOCKS
200 200
201 #define ENV_MEM_LAYOUT_SETTINGS \ 201 #define ENV_MEM_LAYOUT_SETTINGS \
202 "fdt_high=10000000\0" \ 202 "fdt_high=10000000\0" \
203 "initrd_high=10000000\0" \ 203 "initrd_high=10000000\0" \
204 "fdt_addr_r=0x40000000\0" \ 204 "fdt_addr_r=0x40000000\0" \
205 "pxefile_addr_r=0x10000000\0" \ 205 "pxefile_addr_r=0x10000000\0" \
206 "kernel_addr_r=0x18000000\0" \ 206 "kernel_addr_r=0x18000000\0" \
207 "scriptaddr=0x02000000\0" \ 207 "scriptaddr=0x02000000\0" \
208 "ramdisk_addr_r=0x02100000\0" \ 208 "ramdisk_addr_r=0x02100000\0" \
209 209
210 #if defined(CONFIG_MMC_SDHCI_ZYNQ) 210 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
211 # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) 211 # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
212 #else 212 #else
213 # define BOOT_TARGET_DEVICES_MMC(func) 213 # define BOOT_TARGET_DEVICES_MMC(func)
214 #endif 214 #endif
215 215
216 #if defined(CONFIG_SATA_CEVA) 216 #if defined(CONFIG_SATA_CEVA)
217 # define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) 217 # define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
218 #else 218 #else
219 # define BOOT_TARGET_DEVICES_SCSI(func) 219 # define BOOT_TARGET_DEVICES_SCSI(func)
220 #endif 220 #endif
221 221
222 #if defined(CONFIG_ZYNQMP_USB) 222 #if defined(CONFIG_ZYNQMP_USB)
223 # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) 223 # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
224 #else 224 #else
225 # define BOOT_TARGET_DEVICES_USB(func) 225 # define BOOT_TARGET_DEVICES_USB(func)
226 #endif 226 #endif
227 227
228 #define BOOT_TARGET_DEVICES(func) \ 228 #define BOOT_TARGET_DEVICES(func) \
229 BOOT_TARGET_DEVICES_MMC(func) \ 229 BOOT_TARGET_DEVICES_MMC(func) \
230 BOOT_TARGET_DEVICES_USB(func) \ 230 BOOT_TARGET_DEVICES_USB(func) \
231 BOOT_TARGET_DEVICES_SCSI(func) \ 231 BOOT_TARGET_DEVICES_SCSI(func) \
232 func(PXE, pxe, na) \ 232 func(PXE, pxe, na) \
233 func(DHCP, dhcp, na) 233 func(DHCP, dhcp, na)
234 234
235 #include <config_distro_bootcmd.h> 235 #include <config_distro_bootcmd.h>
236 236
237 /* Initial environment variables */ 237 /* Initial environment variables */
238 #ifndef CONFIG_EXTRA_ENV_SETTINGS 238 #ifndef CONFIG_EXTRA_ENV_SETTINGS
239 #define CONFIG_EXTRA_ENV_SETTINGS \ 239 #define CONFIG_EXTRA_ENV_SETTINGS \
240 ENV_MEM_LAYOUT_SETTINGS \ 240 ENV_MEM_LAYOUT_SETTINGS \
241 BOOTENV \ 241 BOOTENV \
242 DFU_ALT_INFO 242 DFU_ALT_INFO
243 #endif 243 #endif
244 244
245 /* SPL can't handle all huge variables - define just DFU */ 245 /* SPL can't handle all huge variables - define just DFU */
246 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT) 246 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT)
247 #undef CONFIG_EXTRA_ENV_SETTINGS 247 #undef CONFIG_EXTRA_ENV_SETTINGS
248 # define CONFIG_EXTRA_ENV_SETTINGS \ 248 # define CONFIG_EXTRA_ENV_SETTINGS \
249 "dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000;" \ 249 "dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000;" \
250 "atf-uboot.ub ram 0x10000000 0x1000000;" \ 250 "atf-uboot.ub ram 0x10000000 0x1000000;" \
251 "Image ram 0x80000 0x3f80000;" \ 251 "Image ram 0x80000 0x3f80000;" \
252 "system.dtb ram 0x4000000 0x100000\0" \ 252 "system.dtb ram 0x4000000 0x100000\0" \
253 "dfu_bufsiz=0x1000\0" 253 "dfu_bufsiz=0x1000\0"
254 #endif 254 #endif
255 255
256 #define CONFIG_SPL_TEXT_BASE 0xfffc0000 256 #define CONFIG_SPL_TEXT_BASE 0xfffc0000
257 #define CONFIG_SPL_STACK 0xfffffffc 257 #define CONFIG_SPL_STACK 0xfffffffc
258 #define CONFIG_SPL_MAX_SIZE 0x40000 258 #define CONFIG_SPL_MAX_SIZE 0x40000
259 259
260 /* Just random location in OCM */ 260 /* Just random location in OCM */
261 #define CONFIG_SPL_BSS_START_ADDR 0x0 261 #define CONFIG_SPL_BSS_START_ADDR 0x0
262 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 262 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000
263 263
264 #define CONFIG_SPL_FRAMEWORK 264 #define CONFIG_SPL_FRAMEWORK
265 265
266 /* u-boot is like dtb */ 266 /* u-boot is like dtb */
267 #define CONFIG_SPL_FS_LOAD_ARGS_NAME "u-boot.bin" 267 #define CONFIG_SPL_FS_LOAD_ARGS_NAME "u-boot.bin"
268 #define CONFIG_SYS_SPL_ARGS_ADDR 0x8000000 268 #define CONFIG_SYS_SPL_ARGS_ADDR 0x8000000
269 269
270 /* ATF is my kernel image */ 270 /* ATF is my kernel image */
271 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "atf-uboot.ub" 271 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "atf-uboot.ub"
272 272
273 /* FIT load address for RAM boot */ 273 /* FIT load address for RAM boot */
274 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x10000000 274 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x10000000
275 275
276 /* MMC support */ 276 /* MMC support */
277 #ifdef CONFIG_MMC_SDHCI_ZYNQ 277 #ifdef CONFIG_MMC_SDHCI_ZYNQ
278 # define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 278 # define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
279 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 /* unused */ 279 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0 /* unused */
280 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 /* unused */ 280 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0 /* unused */
281 # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0 /* unused */ 281 # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0 /* unused */
282 # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" 282 # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
283 #endif 283 #endif
284 284
285 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT) 285 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT)
286 # undef CONFIG_CMD_BOOTD 286 # undef CONFIG_CMD_BOOTD
287 # define CONFIG_SPL_ENV_SUPPORT 287 # define CONFIG_SPL_ENV_SUPPORT
288 # define CONFIG_SPL_HASH_SUPPORT 288 # define CONFIG_SPL_HASH_SUPPORT
289 # define CONFIG_ENV_MAX_ENTRIES 10 289 # define CONFIG_ENV_MAX_ENTRIES 10
290 290
291 # define CONFIG_SYS_SPL_MALLOC_START 0x20000000 291 # define CONFIG_SYS_SPL_MALLOC_START 0x20000000
292 # define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 292 # define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
293 293
294 #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE 294 #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
295 # error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used" 295 # error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used"
296 #endif 296 #endif
297 #endif 297 #endif
298 298
299 #define CONFIG_BOARD_EARLY_INIT_F
300
299 #endif /* __XILINX_ZYNQMP_H */ 301 #endif /* __XILINX_ZYNQMP_H */
300 302