diff options
author | Sipke Vriend <sipke.vriend@xilinx.com> | 2013-09-12 11:05:00 +1000 |
---|---|---|
committer | Sipke Vriend <sipke.vriend@xilinx.com> | 2013-09-12 11:05:00 +1000 |
commit | f10288fe45eb30893bea37d10d533079d4c8b7f9 (patch) | |
tree | 38865cf7ddc1bea4d53878e4c4a524d7ee2c66ec | |
parent | 137abefc80c2bd240960ae16626ed6564a8a9196 (diff) | |
download | meta-xilinx-f10288fe45eb30893bea37d10d533079d4c8b7f9.tar.gz |
recipes-bsp:u-boot Remove u-boot 2013.01.01 target.
Yocto 1.5 master has removed 2013.01 u-boot as a target, so follow suit.
Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com>
6 files changed, 0 insertions, 14927 deletions
diff --git a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0001-Xilinx-modifications-to-arch.patch b/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0001-Xilinx-modifications-to-arch.patch deleted file mode 100644 index 0842ade4..00000000 --- a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0001-Xilinx-modifications-to-arch.patch +++ /dev/null | |||
@@ -1,1131 +0,0 @@ | |||
1 | From f111a3294585ca536b2db2d19d1cbd6d1ec2b39a Mon Sep 17 00:00:00 2001 | ||
2 | From: Sipke Vriend <sipke.vriend@xilinx.com> | ||
3 | Date: Tue, 21 May 2013 07:19:12 +1000 | ||
4 | Subject: [PATCH 1/5] Xilinx modifications to arch | ||
5 | |||
6 | Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> | ||
7 | --- | ||
8 | arch/arm/cpu/armv7/zynq/Makefile | 1 + | ||
9 | arch/arm/cpu/armv7/zynq/config.mk | 25 +++ | ||
10 | arch/arm/cpu/armv7/zynq/cpu.c | 28 +++- | ||
11 | arch/arm/cpu/armv7/zynq/slcr.c | 240 ++++++++++++++++++++++++ | ||
12 | arch/arm/include/asm/arch-zynq/hardware.h | 96 ++++++++++ | ||
13 | arch/arm/include/asm/arch-zynq/mmc.h | 37 ++++ | ||
14 | arch/arm/include/asm/arch-zynq/nand.h | 25 +++ | ||
15 | arch/arm/include/asm/arch-zynq/sys_proto.h | 36 ++++ | ||
16 | arch/arm/lib/board.c | 2 +- | ||
17 | arch/arm/lib/bootm.c | 15 +-- | ||
18 | arch/microblaze/include/asm/icap.h | 279 ++++++++++++++++++++++++++++ | ||
19 | arch/microblaze/include/asm/processor.h | 4 + | ||
20 | arch/microblaze/lib/Makefile | 1 + | ||
21 | arch/microblaze/lib/board.c | 3 + | ||
22 | arch/microblaze/lib/bootm.c | 63 +++++++ | ||
23 | arch/microblaze/lib/muldi3.c | 91 +++++++++ | ||
24 | 16 files changed, 930 insertions(+), 16 deletions(-) | ||
25 | create mode 100644 arch/arm/cpu/armv7/zynq/config.mk | ||
26 | create mode 100644 arch/arm/cpu/armv7/zynq/slcr.c | ||
27 | create mode 100644 arch/arm/include/asm/arch-zynq/hardware.h | ||
28 | create mode 100644 arch/arm/include/asm/arch-zynq/mmc.h | ||
29 | create mode 100644 arch/arm/include/asm/arch-zynq/nand.h | ||
30 | create mode 100644 arch/arm/include/asm/arch-zynq/sys_proto.h | ||
31 | create mode 100644 arch/microblaze/include/asm/icap.h | ||
32 | create mode 100644 arch/microblaze/lib/muldi3.c | ||
33 | |||
34 | diff --git a/arch/arm/cpu/armv7/zynq/Makefile b/arch/arm/cpu/armv7/zynq/Makefile | ||
35 | index 499ace4..388085d 100644 | ||
36 | --- a/arch/arm/cpu/armv7/zynq/Makefile | ||
37 | +++ b/arch/arm/cpu/armv7/zynq/Makefile | ||
38 | @@ -30,6 +30,7 @@ LIB = $(obj)lib$(SOC).o | ||
39 | |||
40 | COBJS-y := timer.o | ||
41 | COBJS-y += cpu.o | ||
42 | +COBJS-y += slcr.o | ||
43 | |||
44 | COBJS := $(COBJS-y) | ||
45 | |||
46 | diff --git a/arch/arm/cpu/armv7/zynq/config.mk b/arch/arm/cpu/armv7/zynq/config.mk | ||
47 | new file mode 100644 | ||
48 | index 0000000..85996f3 | ||
49 | --- /dev/null | ||
50 | +++ b/arch/arm/cpu/armv7/zynq/config.mk | ||
51 | @@ -0,0 +1,25 @@ | ||
52 | +# | ||
53 | +# (C) Copyright 2002 | ||
54 | +# Gary Jennejohn, DENX Software Engineering, <gj@denx.de> | ||
55 | +# | ||
56 | +# See file CREDITS for list of people who contributed to this | ||
57 | +# project. | ||
58 | +# | ||
59 | +# This program is free software; you can redistribute it and/or | ||
60 | +# modify it under the terms of the GNU General Public License as | ||
61 | +# published by the Free Software Foundation; either version 2 of | ||
62 | +# the License, or (at your option) any later version. | ||
63 | +# | ||
64 | +# This program is distributed in the hope that it will be useful, | ||
65 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
66 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
67 | +# GNU General Public License for more details. | ||
68 | +# | ||
69 | +# You should have received a copy of the GNU General Public License | ||
70 | +# along with this program; if not, write to the Free Software | ||
71 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
72 | +# MA 02111-1307 USA | ||
73 | +# | ||
74 | +PLATFORM_RELFLAGS += -fno-strict-aliasing | ||
75 | +# Xilinx, added to prevent unaligned accesses which started happening # with GCC 4.5.2 tools | ||
76 | +PLATFORM_RELFLAGS += -mno-unaligned-access | ||
77 | diff --git a/arch/arm/cpu/armv7/zynq/cpu.c b/arch/arm/cpu/armv7/zynq/cpu.c | ||
78 | index ab615cc..e8f4c19 100644 | ||
79 | --- a/arch/arm/cpu/armv7/zynq/cpu.c | ||
80 | +++ b/arch/arm/cpu/armv7/zynq/cpu.c | ||
81 | @@ -21,11 +21,37 @@ | ||
82 | * MA 02111-1307 USA | ||
83 | */ | ||
84 | #include <common.h> | ||
85 | +#include <asm/io.h> | ||
86 | +#include <asm/arch/sys_proto.h> | ||
87 | +#include <asm/arch/hardware.h> | ||
88 | |||
89 | -inline void lowlevel_init(void) {} | ||
90 | +void lowlevel_init(void) | ||
91 | +{ | ||
92 | + zynq_slcr_unlock(); | ||
93 | + /* remap DDR to zero, FILTERSTART */ | ||
94 | + writel(0, &scu_base->filter_start); | ||
95 | + | ||
96 | + /* Device config APB, unlock the PCAP */ | ||
97 | + writel(0x757BDF0D, &devcfg_base->unlock); | ||
98 | + writel(0xFFFFFFFF, &devcfg_base->rom_shadow); | ||
99 | + | ||
100 | + /* OCM_CFG, Mask out the ROM, map ram into upper addresses */ | ||
101 | + writel(0x1F, &slcr_base->ocm_cfg); | ||
102 | + /* FPGA_RST_CTRL, clear resets on AXI fabric ports */ | ||
103 | + writel(0x0, &slcr_base->fpga_rst_ctrl); | ||
104 | + /* TZ_DDR_RAM, Set DDR trust zone non-secure */ | ||
105 | + writel(0xFFFFFFFF, &slcr_base->trust_zone); | ||
106 | + /* Set urgent bits with register */ | ||
107 | + writel(0x0, &slcr_base->ddr_urgent_sel); | ||
108 | + /* Urgent write, ports S2/S3 */ | ||
109 | + writel(0xC, &slcr_base->ddr_urgent); | ||
110 | + | ||
111 | + zynq_slcr_lock(); | ||
112 | +} | ||
113 | |||
114 | void reset_cpu(ulong addr) | ||
115 | { | ||
116 | + zynq_slcr_cpu_reset(); | ||
117 | while (1) | ||
118 | ; | ||
119 | } | ||
120 | diff --git a/arch/arm/cpu/armv7/zynq/slcr.c b/arch/arm/cpu/armv7/zynq/slcr.c | ||
121 | new file mode 100644 | ||
122 | index 0000000..e5f710d | ||
123 | --- /dev/null | ||
124 | +++ b/arch/arm/cpu/armv7/zynq/slcr.c | ||
125 | @@ -0,0 +1,240 @@ | ||
126 | +/* | ||
127 | + * Copyright (c) 2013 Xilinx Inc. | ||
128 | + * | ||
129 | + * See file CREDITS for list of people who contributed to this | ||
130 | + * project. | ||
131 | + * | ||
132 | + * This program is free software; you can redistribute it and/or | ||
133 | + * modify it under the terms of the GNU General Public License as | ||
134 | + * published by the Free Software Foundation; either version 2 of | ||
135 | + * the License, or (at your option) any later version. | ||
136 | + * | ||
137 | + * This program is distributed in the hope that it will be useful, | ||
138 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
139 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
140 | + * GNU General Public License for more details. | ||
141 | + * | ||
142 | + * You should have received a copy of the GNU General Public License | ||
143 | + * along with this program; if not, write to the Free Software | ||
144 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
145 | + * MA 02111-1307 USA | ||
146 | + */ | ||
147 | + | ||
148 | +#include <common.h> | ||
149 | +#include <asm/io.h> | ||
150 | +#include <malloc.h> | ||
151 | +#include <asm/arch/hardware.h> | ||
152 | + | ||
153 | +#define SLCR_LOCK_MAGIC 0x767B | ||
154 | +#define SLCR_UNLOCK_MAGIC 0xDF0D | ||
155 | + | ||
156 | +#define SLCR_QSPI_ENABLE 0x02 | ||
157 | +#define SLCR_QSPI_ENABLE_MASK 0x03 | ||
158 | +#define SLCR_NAND_L2_SEL 0x10 | ||
159 | +#define SLCR_NAND_L2_SEL_MASK 0x1F | ||
160 | + | ||
161 | +#define SLCR_IDCODE_MASK 0x1F000 | ||
162 | +#define SLCR_IDCODE_SHIFT 12 | ||
163 | + | ||
164 | +/* | ||
165 | + * zynq_slcr_mio_get_status - Get the status of MIO peripheral. | ||
166 | + * | ||
167 | + * @peri_name: Name of the peripheral for checking MIO status | ||
168 | + * @get_pins: Pointer to array of get pin for this peripheral | ||
169 | + * @num_pins: Number of pins for this peripheral | ||
170 | + * @mask: Mask value | ||
171 | + * @check_val: Required check value to get the status of periph | ||
172 | + */ | ||
173 | +struct zynq_slcr_mio_get_status { | ||
174 | + const char *peri_name; | ||
175 | + const int *get_pins; | ||
176 | + int num_pins; | ||
177 | + u32 mask; | ||
178 | + u32 check_val; | ||
179 | +}; | ||
180 | + | ||
181 | +static const int qspi0_pins[] = { | ||
182 | + 1, 2, 3, 4, 5, 6 | ||
183 | +}; | ||
184 | + | ||
185 | +static const int qspi1_cs_pin[] = { | ||
186 | + 0 | ||
187 | +}; | ||
188 | + | ||
189 | +static const int qspi1_pins[] = { | ||
190 | + 9, 10, 11, 12, 13 | ||
191 | +}; | ||
192 | + | ||
193 | +static const int nand8_pins[] = { | ||
194 | + 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 | ||
195 | +}; | ||
196 | + | ||
197 | +static const int nand16_pins[] = { | ||
198 | + 16, 17, 18, 19, 20, 21, 22, 23 | ||
199 | +}; | ||
200 | + | ||
201 | +static const struct zynq_slcr_mio_get_status mio_periphs[] = { | ||
202 | + { | ||
203 | + "qspi0", | ||
204 | + qspi0_pins, | ||
205 | + ARRAY_SIZE(qspi0_pins), | ||
206 | + SLCR_QSPI_ENABLE_MASK, | ||
207 | + SLCR_QSPI_ENABLE, | ||
208 | + }, | ||
209 | + { | ||
210 | + "qspi1_cs", | ||
211 | + qspi1_cs_pin, | ||
212 | + ARRAY_SIZE(qspi1_cs_pin), | ||
213 | + SLCR_QSPI_ENABLE_MASK, | ||
214 | + SLCR_QSPI_ENABLE, | ||
215 | + }, | ||
216 | + { | ||
217 | + "qspi1", | ||
218 | + qspi1_pins, | ||
219 | + ARRAY_SIZE(qspi1_pins), | ||
220 | + SLCR_QSPI_ENABLE_MASK, | ||
221 | + SLCR_QSPI_ENABLE, | ||
222 | + }, | ||
223 | + { | ||
224 | + "nand8", | ||
225 | + nand8_pins, | ||
226 | + ARRAY_SIZE(nand8_pins), | ||
227 | + SLCR_NAND_L2_SEL_MASK, | ||
228 | + SLCR_NAND_L2_SEL, | ||
229 | + }, | ||
230 | + { | ||
231 | + "nand16", | ||
232 | + nand16_pins, | ||
233 | + ARRAY_SIZE(nand16_pins), | ||
234 | + SLCR_NAND_L2_SEL_MASK, | ||
235 | + SLCR_NAND_L2_SEL, | ||
236 | + }, | ||
237 | +}; | ||
238 | + | ||
239 | +static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */ | ||
240 | + | ||
241 | +void zynq_slcr_lock(void) | ||
242 | +{ | ||
243 | + if (!slcr_lock) | ||
244 | + writel(SLCR_LOCK_MAGIC, &slcr_base->slcr_lock); | ||
245 | +} | ||
246 | + | ||
247 | +void zynq_slcr_unlock(void) | ||
248 | +{ | ||
249 | + if (slcr_lock) | ||
250 | + writel(SLCR_UNLOCK_MAGIC, &slcr_base->slcr_unlock); | ||
251 | +} | ||
252 | + | ||
253 | +/* Reset the entire system */ | ||
254 | +void zynq_slcr_cpu_reset(void) | ||
255 | +{ | ||
256 | + /* | ||
257 | + * Unlock the SLCR then reset the system. | ||
258 | + * Note that this seems to require raw i/o | ||
259 | + * functions or there's a lockup? | ||
260 | + */ | ||
261 | + zynq_slcr_unlock(); | ||
262 | + | ||
263 | + /* | ||
264 | + * Clear 0x0F000000 bits of reboot status register to workaround | ||
265 | + * the FSBL not loading the bitstream after soft-reboot | ||
266 | + * This is a temporary solution until we know more. | ||
267 | + */ | ||
268 | + clrbits_le32(&slcr_base->reboot_status, 0xF000000); | ||
269 | + | ||
270 | + writel(1, &slcr_base->pss_rst_ctrl); | ||
271 | +} | ||
272 | + | ||
273 | +/* Setup clk for network */ | ||
274 | +void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk) | ||
275 | +{ | ||
276 | + zynq_slcr_unlock(); | ||
277 | + | ||
278 | + if (gem_id > 1) { | ||
279 | + printf("Non existing GEM id %d\n", gem_id); | ||
280 | + goto out; | ||
281 | + } | ||
282 | + | ||
283 | + if (gem_id) { | ||
284 | + /* Set divisors for appropriate frequency in GEM_CLK_CTRL */ | ||
285 | + writel(clk, &slcr_base->gem1_clk_ctrl); | ||
286 | + /* Configure GEM_RCLK_CTRL */ | ||
287 | + writel(rclk, &slcr_base->gem1_rclk_ctrl); | ||
288 | + } else { | ||
289 | + /* Set divisors for appropriate frequency in GEM_CLK_CTRL */ | ||
290 | + writel(clk, &slcr_base->gem0_clk_ctrl); | ||
291 | + /* Configure GEM_RCLK_CTRL */ | ||
292 | + writel(rclk, &slcr_base->gem0_rclk_ctrl); | ||
293 | + } | ||
294 | + | ||
295 | +out: | ||
296 | + zynq_slcr_lock(); | ||
297 | +} | ||
298 | + | ||
299 | +void zynq_slcr_devcfg_disable(void) | ||
300 | +{ | ||
301 | + zynq_slcr_unlock(); | ||
302 | + | ||
303 | + /* Disable AXI interface */ | ||
304 | + writel(0xFFFFFFFF, &slcr_base->fpga_rst_ctrl); | ||
305 | + | ||
306 | + /* Set Level Shifters DT618760 */ | ||
307 | + writel(0xA, &slcr_base->lvl_shftr_en); | ||
308 | + | ||
309 | + zynq_slcr_lock(); | ||
310 | +} | ||
311 | + | ||
312 | +void zynq_slcr_devcfg_enable(void) | ||
313 | +{ | ||
314 | + zynq_slcr_unlock(); | ||
315 | + | ||
316 | + /* Set Level Shifters DT618760 */ | ||
317 | + writel(0xF, &slcr_base->lvl_shftr_en); | ||
318 | + | ||
319 | + /* Disable AXI interface */ | ||
320 | + writel(0x0, &slcr_base->fpga_rst_ctrl); | ||
321 | + | ||
322 | + zynq_slcr_lock(); | ||
323 | +} | ||
324 | + | ||
325 | +u32 zynq_slcr_get_boot_mode(void) | ||
326 | +{ | ||
327 | + /* Get the bootmode register value */ | ||
328 | + return readl(&slcr_base->boot_mode); | ||
329 | +} | ||
330 | + | ||
331 | +u32 zynq_slcr_get_idcode(void) | ||
332 | +{ | ||
333 | + return (readl(&slcr_base->pss_idcode) & SLCR_IDCODE_MASK) >> | ||
334 | + SLCR_IDCODE_SHIFT; | ||
335 | +} | ||
336 | + | ||
337 | +/* | ||
338 | + * zynq_slcr_get_mio_pin_status - Get the MIO pin status of peripheral. | ||
339 | + * | ||
340 | + * @periph: Name of the peripheral | ||
341 | + * | ||
342 | + * Returns count to indicate the number of pins configured for the | ||
343 | + * given @periph. | ||
344 | + */ | ||
345 | +int zynq_slcr_get_mio_pin_status(const char *periph) | ||
346 | +{ | ||
347 | + const struct zynq_slcr_mio_get_status *mio_ptr; | ||
348 | + int val, i, j; | ||
349 | + int mio = 0; | ||
350 | + | ||
351 | + for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) { | ||
352 | + if (strcmp(periph, mio_periphs[i].peri_name) == 0) { | ||
353 | + mio_ptr = &mio_periphs[i]; | ||
354 | + for (j = 0; j < mio_ptr->num_pins; j++) { | ||
355 | + val = readl(&slcr_base->mio_pin | ||
356 | + [mio_ptr->get_pins[j]]); | ||
357 | + if ((val & mio_ptr->mask) == mio_ptr->check_val) | ||
358 | + mio++; | ||
359 | + } | ||
360 | + break; | ||
361 | + } | ||
362 | + } | ||
363 | + | ||
364 | + return mio; | ||
365 | +} | ||
366 | diff --git a/arch/arm/include/asm/arch-zynq/hardware.h b/arch/arm/include/asm/arch-zynq/hardware.h | ||
367 | new file mode 100644 | ||
368 | index 0000000..3fd980a | ||
369 | --- /dev/null | ||
370 | +++ b/arch/arm/include/asm/arch-zynq/hardware.h | ||
371 | @@ -0,0 +1,96 @@ | ||
372 | +/* | ||
373 | + * Copyright (c) 2013 Xilinx Inc. | ||
374 | + * | ||
375 | + * See file CREDITS for list of people who contributed to this | ||
376 | + * project. | ||
377 | + * | ||
378 | + * This program is free software; you can redistribute it and/or | ||
379 | + * modify it under the terms of the GNU General Public License as | ||
380 | + * published by the Free Software Foundation; either version 2 of | ||
381 | + * the License, or (at your option) any later version. | ||
382 | + * | ||
383 | + * This program is distributed in the hope that it will be useful, | ||
384 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
385 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
386 | + * GNU General Public License for more details. | ||
387 | + * | ||
388 | + * You should have received a copy of the GNU General Public License | ||
389 | + * along with this program; if not, write to the Free Software | ||
390 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
391 | + * MA 02111-1307 USA | ||
392 | + */ | ||
393 | + | ||
394 | +#ifndef _ASM_ARCH_HARDWARE_H | ||
395 | +#define _ASM_ARCH_HARDWARE_H | ||
396 | + | ||
397 | +#define XPSS_SYS_CTRL_BASEADDR 0xF8000000 | ||
398 | +#define XPSS_DEV_CFG_APB_BASEADDR 0xF8007000 | ||
399 | +#define XPSS_SCU_BASEADDR 0xF8F00000 | ||
400 | + | ||
401 | +/* Reflect slcr offsets */ | ||
402 | +struct slcr_regs { | ||
403 | + u32 scl; /* 0x0 */ | ||
404 | + u32 slcr_lock; /* 0x4 */ | ||
405 | + u32 slcr_unlock; /* 0x8 */ | ||
406 | + u32 reserved0[75]; | ||
407 | + u32 gem0_rclk_ctrl; /* 0x138 */ | ||
408 | + u32 gem1_rclk_ctrl; /* 0x13c */ | ||
409 | + u32 gem0_clk_ctrl; /* 0x140 */ | ||
410 | + u32 gem1_clk_ctrl; /* 0x144 */ | ||
411 | + u32 reserved1[46]; | ||
412 | + u32 pss_rst_ctrl; /* 0x200 */ | ||
413 | + u32 reserved2[15]; | ||
414 | + u32 fpga_rst_ctrl; /* 0x240 */ | ||
415 | + u32 reserved3[5]; | ||
416 | + u32 reboot_status; /* 0x258 */ | ||
417 | + u32 boot_mode; /* 0x25c */ | ||
418 | + u32 reserved4[116]; | ||
419 | + u32 trust_zone; /* 0x430 */ /* FIXME */ | ||
420 | + u32 reserved5_1[63]; | ||
421 | + u32 pss_idcode; /* 0x530 */ | ||
422 | + u32 reserved5_2[51]; | ||
423 | + u32 ddr_urgent; /* 0x600 */ | ||
424 | + u32 reserved6[6]; | ||
425 | + u32 ddr_urgent_sel; /* 0x61c */ | ||
426 | + u32 reserved7[56]; | ||
427 | + u32 mio_pin[54]; /* 0x700 - 0x7D4 */ | ||
428 | + u32 reserved8[74]; | ||
429 | + u32 lvl_shftr_en; /* 0x900 */ | ||
430 | + u32 reserved9[3]; | ||
431 | + u32 ocm_cfg; /* 0x910 */ | ||
432 | +}; | ||
433 | + | ||
434 | +#define slcr_base ((struct slcr_regs *) XPSS_SYS_CTRL_BASEADDR) | ||
435 | + | ||
436 | +struct devcfg_regs { | ||
437 | + u32 ctrl; /* 0x0 */ | ||
438 | + u32 lock; /* 0x4 */ | ||
439 | + u32 cfg; /* 0x8 */ | ||
440 | + u32 int_sts; /* 0xc */ | ||
441 | + u32 int_mask; /* 0x10 */ | ||
442 | + u32 status; /* 0x14 */ | ||
443 | + u32 dma_src_addr; /* 0x18 */ | ||
444 | + u32 dma_dst_addr; /* 0x1c */ | ||
445 | + u32 dma_src_len; /* 0x20 */ | ||
446 | + u32 dma_dst_len; /* 0x24 */ | ||
447 | + u32 rom_shadow; /* 0x28 */ | ||
448 | + u32 reserved1[2]; | ||
449 | + u32 unlock; /* 0x34 */ | ||
450 | + u32 reserved2[18]; | ||
451 | + u32 mctrl; /* 0x80 */ | ||
452 | + u32 reserved3; | ||
453 | + u32 write_count; /* 0x88 */ | ||
454 | + u32 read_count; /* 0x8c */ | ||
455 | +}; | ||
456 | + | ||
457 | +#define devcfg_base ((struct devcfg_regs *) XPSS_DEV_CFG_APB_BASEADDR) | ||
458 | + | ||
459 | +struct scu_regs { | ||
460 | + u32 reserved1[16]; | ||
461 | + u32 filter_start; /* 0x40 */ | ||
462 | + u32 filter_end; /* 0x44 */ | ||
463 | +}; | ||
464 | + | ||
465 | +#define scu_base ((struct scu_regs *) XPSS_SCU_BASEADDR) | ||
466 | + | ||
467 | +#endif /* _ASM_ARCH_HARDWARE_H */ | ||
468 | diff --git a/arch/arm/include/asm/arch-zynq/mmc.h b/arch/arm/include/asm/arch-zynq/mmc.h | ||
469 | new file mode 100644 | ||
470 | index 0000000..18dd036 | ||
471 | --- /dev/null | ||
472 | +++ b/arch/arm/include/asm/arch-zynq/mmc.h | ||
473 | @@ -0,0 +1,37 @@ | ||
474 | +/* | ||
475 | + * Copyright 2012 Joe Hershberger <joe.hershberger@ni.com> | ||
476 | + * | ||
477 | + * See file CREDITS for list of people who contributed to this | ||
478 | + * project. | ||
479 | + * | ||
480 | + * This program is free software; you can redistribute it and/or | ||
481 | + * modify it under the terms of the GNU General Public License as | ||
482 | + * published by the Free Software Foundation; either version 2 of | ||
483 | + * the License, or (at your option) any later version. | ||
484 | + * | ||
485 | + * This program is distributed in the hope that it will be useful, | ||
486 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
487 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
488 | + * GNU General Public License for more details. | ||
489 | + * | ||
490 | + * You should have received a copy of the GNU General Public License | ||
491 | + * along with this program; if not, write to the Free Software | ||
492 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
493 | + * MA 02111-1307 USA | ||
494 | + */ | ||
495 | + | ||
496 | +#ifndef __ASM_ARCH_MMC_H_ | ||
497 | +#define __ASM_ARCH_MMC_H_ | ||
498 | + | ||
499 | +#include <config.h> | ||
500 | + | ||
501 | +int zynq_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk); | ||
502 | + | ||
503 | +static inline int zynq_mmc_init(bd_t *bd) | ||
504 | +{ | ||
505 | + u32 regbase = (u32) SD_BASEADDR; | ||
506 | + | ||
507 | + return zynq_sdhci_init(regbase, 52000000, 52000000 >> 9); | ||
508 | +} | ||
509 | + | ||
510 | +#endif /* __ASM_ARCH_MMC_H_ */ | ||
511 | diff --git a/arch/arm/include/asm/arch-zynq/nand.h b/arch/arm/include/asm/arch-zynq/nand.h | ||
512 | new file mode 100644 | ||
513 | index 0000000..33a7d20 | ||
514 | --- /dev/null | ||
515 | +++ b/arch/arm/include/asm/arch-zynq/nand.h | ||
516 | @@ -0,0 +1,25 @@ | ||
517 | +/* | ||
518 | + * Copyright 2012 Joe Hershberger <joe.hershberger@ni.com> | ||
519 | + * | ||
520 | + * See file CREDITS for list of people who contributed to this | ||
521 | + * project. | ||
522 | + * | ||
523 | + * This program is free software; you can redistribute it and/or | ||
524 | + * modify it under the terms of the GNU General Public License as | ||
525 | + * published by the Free Software Foundation; either version 2 of | ||
526 | + * the License, or (at your option) any later version. | ||
527 | + * | ||
528 | + * This program is distributed in the hope that it will be useful, | ||
529 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
530 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
531 | + * GNU General Public License for more details. | ||
532 | + * | ||
533 | + * You should have received a copy of the GNU General Public License | ||
534 | + * along with this program; if not, write to the Free Software | ||
535 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
536 | + * MA 02111-1307 USA | ||
537 | + */ | ||
538 | + | ||
539 | +#include <nand.h> | ||
540 | + | ||
541 | +extern int zynq_nand_init(struct nand_chip *nand_chip); | ||
542 | diff --git a/arch/arm/include/asm/arch-zynq/sys_proto.h b/arch/arm/include/asm/arch-zynq/sys_proto.h | ||
543 | new file mode 100644 | ||
544 | index 0000000..411589e | ||
545 | --- /dev/null | ||
546 | +++ b/arch/arm/include/asm/arch-zynq/sys_proto.h | ||
547 | @@ -0,0 +1,36 @@ | ||
548 | +/* | ||
549 | + * Copyright (c) 2013 Xilinx Inc. | ||
550 | + * | ||
551 | + * See file CREDITS for list of people who contributed to this | ||
552 | + * project. | ||
553 | + * | ||
554 | + * This program is free software; you can redistribute it and/or | ||
555 | + * modify it under the terms of the GNU General Public License as | ||
556 | + * published by the Free Software Foundation; either version 2 of | ||
557 | + * the License, or (at your option) any later version. | ||
558 | + * | ||
559 | + * This program is distributed in the hope that it will be useful, | ||
560 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
561 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
562 | + * GNU General Public License for more details. | ||
563 | + * | ||
564 | + * You should have received a copy of the GNU General Public License | ||
565 | + * along with this program; if not, write to the Free Software | ||
566 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
567 | + * MA 02111-1307 USA | ||
568 | + */ | ||
569 | + | ||
570 | +#ifndef _SYS_PROTO_H_ | ||
571 | +#define _SYS_PROTO_H_ | ||
572 | + | ||
573 | +extern void zynq_slcr_lock(void); | ||
574 | +extern void zynq_slcr_unlock(void); | ||
575 | +extern void zynq_slcr_cpu_reset(void); | ||
576 | +extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk); | ||
577 | +extern void zynq_slcr_devcfg_disable(void); | ||
578 | +extern void zynq_slcr_devcfg_enable(void); | ||
579 | +extern u32 zynq_slcr_get_boot_mode(void); | ||
580 | +extern u32 zynq_slcr_get_idcode(void); | ||
581 | +extern int zynq_slcr_get_mio_pin_status(const char *periph); | ||
582 | + | ||
583 | +#endif /* _SYS_PROTO_H_ */ | ||
584 | diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c | ||
585 | index 9f861cc..cfe32cc 100644 | ||
586 | --- a/arch/arm/lib/board.c | ||
587 | +++ b/arch/arm/lib/board.c | ||
588 | @@ -488,7 +488,7 @@ static char *failed = "*** failed ***\n"; | ||
589 | static int should_load_env(void) | ||
590 | { | ||
591 | #ifdef CONFIG_OF_CONTROL | ||
592 | - return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1); | ||
593 | + return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0); | ||
594 | #elif defined CONFIG_DELAY_ENVIRONMENT | ||
595 | return 0; | ||
596 | #else | ||
597 | diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c | ||
598 | index 1bd2730..28420e3 100644 | ||
599 | --- a/arch/arm/lib/bootm.c | ||
600 | +++ b/arch/arm/lib/bootm.c | ||
601 | @@ -79,17 +79,7 @@ void arch_lmb_reserve(struct lmb *lmb) | ||
602 | #ifdef CONFIG_OF_LIBFDT | ||
603 | static int fixup_memory_node(void *blob) | ||
604 | { | ||
605 | - bd_t *bd = gd->bd; | ||
606 | - int bank; | ||
607 | - u64 start[CONFIG_NR_DRAM_BANKS]; | ||
608 | - u64 size[CONFIG_NR_DRAM_BANKS]; | ||
609 | - | ||
610 | - for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { | ||
611 | - start[bank] = bd->bi_dram[bank].start; | ||
612 | - size[bank] = bd->bi_dram[bank].size; | ||
613 | - } | ||
614 | - | ||
615 | - return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS); | ||
616 | + return 0; | ||
617 | } | ||
618 | #endif | ||
619 | |||
620 | @@ -315,9 +305,6 @@ static void boot_prep_linux(bootm_headers_t *images) | ||
621 | #endif | ||
622 | setup_board_tags(¶ms); | ||
623 | setup_end_tag(gd->bd); | ||
624 | -#else /* all tags */ | ||
625 | - printf("FDT and ATAGS support not compiled in - hanging\n"); | ||
626 | - hang(); | ||
627 | #endif /* all tags */ | ||
628 | } | ||
629 | } | ||
630 | diff --git a/arch/microblaze/include/asm/icap.h b/arch/microblaze/include/asm/icap.h | ||
631 | new file mode 100644 | ||
632 | index 0000000..8d4fe79 | ||
633 | --- /dev/null | ||
634 | +++ b/arch/microblaze/include/asm/icap.h | ||
635 | @@ -0,0 +1,279 @@ | ||
636 | +#include <asm/io.h> | ||
637 | + | ||
638 | +#define XHwIcap_In32 readl | ||
639 | + | ||
640 | +#define XHwIcap_Out32(a,b) writel(b,a) /* switch address & data */ | ||
641 | + | ||
642 | +/* Packet Types */ | ||
643 | +#define XHI_SYNC_PACKET 0xAA995566 | ||
644 | +#define XHI_DUMMY_PACKET 0xFFFFFFFF | ||
645 | +#define XHI_DEVICE_ID_READ 0x28018001 | ||
646 | +#define XHI_NOOP_PACKET 0x20000000 | ||
647 | + | ||
648 | +/* Command types */ | ||
649 | +#define XHI_TYPE_1 1 | ||
650 | + | ||
651 | +/* Command Direction */ | ||
652 | +#define XHI_OP_READ 1 | ||
653 | + | ||
654 | +/* Register Programming Offsets */ | ||
655 | +#define XHI_TYPE_SHIFT 29 | ||
656 | +#define XHI_REGISTER_SHIFT 13 | ||
657 | +#define XHI_OP_SHIFT 27 | ||
658 | + | ||
659 | +/* Register Offsets */ | ||
660 | +#define XHI_WBSTAR 16 | ||
661 | + | ||
662 | +/* Register offsets for the XHwIcap device. */ | ||
663 | +#define XHI_GIER_OFFSET 0x1C /**< Device Global Interrupt Enable Reg */ | ||
664 | +#define XHI_IPISR_OFFSET 0x20 /**< Interrupt Status Register */ | ||
665 | +#define XHI_IPIER_OFFSET 0x28 /**< Interrupt Enable Register */ | ||
666 | +#define XHI_WF_OFFSET 0x100 /**< Write FIFO */ | ||
667 | +#define XHI_RF_OFFSET 0x104 /**< Read FIFO */ | ||
668 | +#define XHI_SZ_OFFSET 0x108 /**< Size Register */ | ||
669 | +#define XHI_CR_OFFSET 0x10C /**< Control Register */ | ||
670 | +#define XHI_SR_OFFSET 0x110 /**< Status Register */ | ||
671 | +#define XHI_WFV_OFFSET 0x114 /**< Write FIFO Vacancy Register */ | ||
672 | +#define XHI_RFO_OFFSET 0x118 /**< Read FIFO Occupancy Register */ | ||
673 | + | ||
674 | +/* Control Register Contents */ | ||
675 | +#define XHI_CR_READ_MASK 0x00000002 /**< Read from ICAP to FIFO */ | ||
676 | +#define XHI_CR_WRITE_MASK 0x00000001 /**< Write from FIFO to ICAP */ | ||
677 | + | ||
678 | +/* Status Register Contents */ | ||
679 | +#define XHI_SR_DONE_MASK 0x00000001 /**< Done bit Mask */ | ||
680 | + | ||
681 | +/* Number of times to poll the Status Register */ | ||
682 | +#define XHI_MAX_RETRIES 1000 | ||
683 | + | ||
684 | +/* Program Command */ | ||
685 | +#define XHI_CMD_IPROG 15 | ||
686 | + | ||
687 | + | ||
688 | +/****************************************************************************/ | ||
689 | +/** | ||
690 | +* | ||
691 | +* Read from the specified HwIcap device register. | ||
692 | +* | ||
693 | +* @param BaseAddress contains the base address of the device. | ||
694 | +* @param RegOffset contains the offset from the 1st register of the | ||
695 | +* device to select the specific register. | ||
696 | +* | ||
697 | +* @return The value read from the register. | ||
698 | +* | ||
699 | +* @note C-Style signature: | ||
700 | +* u32 XHwIcap_ReadReg(u32 BaseAddress, u32 RegOffset); | ||
701 | +* | ||
702 | +******************************************************************************/ | ||
703 | +#define XHwIcap_ReadReg(BaseAddress, RegOffset) \ | ||
704 | + XHwIcap_In32((BaseAddress) + (RegOffset)) | ||
705 | + | ||
706 | +/***************************************************************************/ | ||
707 | +/** | ||
708 | +* | ||
709 | +* Write to the specified HwIcap device register. | ||
710 | +* | ||
711 | +* @param BaseAddress contains the base address of the device. | ||
712 | +* @param RegOffset contains the offset from the 1st register of the | ||
713 | +* device to select the specific register. | ||
714 | +* @param RegisterValue is the value to be written to the register. | ||
715 | +* | ||
716 | +* @return None. | ||
717 | +* | ||
718 | +* @note C-Style signature: | ||
719 | +* void XHwIcap_WriteReg(u32 BaseAddress, u32 RegOffset, | ||
720 | +* u32 RegisterValue); | ||
721 | +******************************************************************************/ | ||
722 | +#define XHwIcap_WriteReg(BaseAddress, RegOffset, RegisterValue) \ | ||
723 | + XHwIcap_Out32((BaseAddress) + (RegOffset), (RegisterValue)) | ||
724 | + | ||
725 | +/****************************************************************************/ | ||
726 | +/** | ||
727 | +* | ||
728 | +* Write data to the Write FIFO. | ||
729 | +* | ||
730 | +* @param BaseAddress contains the base address of the device. | ||
731 | +* @param Data is the 32-bit value to be written to the FIFO. | ||
732 | +* | ||
733 | +* @return None. | ||
734 | +* | ||
735 | +* @note C-style Signature: | ||
736 | +* void XHwIcap_FifoWrite(u32 BaseAddress, u32 Data); | ||
737 | +* | ||
738 | +*****************************************************************************/ | ||
739 | +#define XHwIcap_FifoWrite(BaseAddress,Data) \ | ||
740 | + (XHwIcap_WriteReg(BaseAddress, XHI_WF_OFFSET, (Data))) | ||
741 | + | ||
742 | +/****************************************************************************/ | ||
743 | +/** | ||
744 | +* | ||
745 | +* Read data from the Read FIFO. | ||
746 | +* | ||
747 | +* @param BaseAddress contains the base address of the device. | ||
748 | +* | ||
749 | +* @return The 32-bit Data read from the FIFO. | ||
750 | +* | ||
751 | +* @note C-style Signature: | ||
752 | +* u32 XHwIcap_FifoRead(u32 BaseAddress); | ||
753 | +* | ||
754 | +*****************************************************************************/ | ||
755 | +#define XHwIcap_FifoRead(BaseAddress) \ | ||
756 | +(XHwIcap_ReadReg(BaseAddress, XHI_RF_OFFSET)) | ||
757 | + | ||
758 | +/****************************************************************************/ | ||
759 | +/** | ||
760 | +* | ||
761 | +* Get the contents of the Control register. | ||
762 | +* | ||
763 | +* @param BaseAddress contains the base address of the device. | ||
764 | +* | ||
765 | +* @return A 32-bit value representing the contents of the Control | ||
766 | +* register. | ||
767 | +* | ||
768 | +* @note u32 XHwIcap_GetControlReg(u32 BaseAddress); | ||
769 | +* | ||
770 | +*****************************************************************************/ | ||
771 | +#define XHwIcap_GetControlReg(BaseAddress) \ | ||
772 | + (XHwIcap_ReadReg(BaseAddress, XHI_CR_OFFSET)) | ||
773 | + | ||
774 | + | ||
775 | +/****************************************************************************/ | ||
776 | +/** | ||
777 | +* | ||
778 | +* Set the Control Register to initiate a configuration (write) to the device. | ||
779 | +* | ||
780 | +* @param BaseAddress contains the base address of the device. | ||
781 | +* | ||
782 | +* @return None. | ||
783 | +* | ||
784 | +* @note C-style Signature: | ||
785 | +* void XHwIcap_StartConfig(u32 BaseAddress); | ||
786 | +* | ||
787 | +*****************************************************************************/ | ||
788 | +#define XHwIcap_StartConfig(BaseAddress) \ | ||
789 | + (XHwIcap_WriteReg(BaseAddress, XHI_CR_OFFSET, (XHwIcap_GetControlReg(BaseAddress) & \ | ||
790 | + (~ XHI_CR_READ_MASK)) | XHI_CR_WRITE_MASK)) | ||
791 | + | ||
792 | +/******************************************************************************/ | ||
793 | +/** | ||
794 | +* | ||
795 | +* This macro returns the vacancy of the Write FIFO. This indicates the | ||
796 | +* number of words that can be written to the Write FIFO before it becomes | ||
797 | +* full. | ||
798 | +* | ||
799 | +* @param BaseAddress contains the base address of the device. | ||
800 | +* | ||
801 | +* @return The contents read from the Write FIFO Vacancy Register. | ||
802 | +* | ||
803 | +* @note C-Style signature: | ||
804 | +* u32 XHwIcap_GetWrFifoVacancy(u32 BaseAddress) | ||
805 | +* | ||
806 | +******************************************************************************/ | ||
807 | +#define XHwIcap_GetWrFifoVacancy(BaseAddress) \ | ||
808 | + XHwIcap_ReadReg(BaseAddress, XHI_WFV_OFFSET) | ||
809 | + | ||
810 | +/******************************************************************************/ | ||
811 | +/** | ||
812 | +* | ||
813 | +* This macro returns the occupancy of the Read FIFO. | ||
814 | +* | ||
815 | +* @param BaseAddress contains the base address of the device. | ||
816 | +* | ||
817 | +* @return The contents read from the Read FIFO Occupancy Register. | ||
818 | +* | ||
819 | +* @note C-Style signature: | ||
820 | +* u32 XHwIcap_GetRdFifoOccupancy(u32 BaseAddress) | ||
821 | +* | ||
822 | +******************************************************************************/ | ||
823 | +#define XHwIcap_GetRdFifoOccupancy(BaseAddress) \ | ||
824 | + XHwIcap_ReadReg(BaseAddress, XHI_RFO_OFFSET) | ||
825 | + | ||
826 | +/****************************************************************************/ | ||
827 | +/** | ||
828 | +* | ||
829 | +* Get the contents of the status register. | ||
830 | +* | ||
831 | +* @param BaseAddress contains the base address of the device. | ||
832 | +* | ||
833 | +* @return A 32-bit value representing the contents of the status register. | ||
834 | +* | ||
835 | +* @note u32 XHwIcap_GetStatusReg(u32 BaseAddress); | ||
836 | +* | ||
837 | +*****************************************************************************/ | ||
838 | +#define XHwIcap_GetStatusReg(BaseAddress) \ | ||
839 | +(XHwIcap_ReadReg(BaseAddress, XHI_SR_OFFSET)) | ||
840 | + | ||
841 | +/****************************************************************************/ | ||
842 | +/** | ||
843 | +* | ||
844 | +* This macro checks if the last Read/Write to the ICAP device in the FPGA | ||
845 | +* is completed. | ||
846 | +* | ||
847 | +* @param BaseAddress contains the base address of the device. | ||
848 | +* | ||
849 | +* @return | ||
850 | +* - 1 if the last Read/Write(Config) to the ICAP is NOT | ||
851 | +* completed. | ||
852 | +* - 0 if the Read/Write(Config) to the ICAP is completed.. | ||
853 | +* | ||
854 | +* @note C-Style signature: | ||
855 | +* int XHwIcap_IsDeviceBusy(u32 BaseAddress); | ||
856 | +* | ||
857 | +*****************************************************************************/ | ||
858 | +#define XHwIcap_IsDeviceBusy(BaseAddress) \ | ||
859 | + ((XHwIcap_GetStatusReg(BaseAddress) & XHI_SR_DONE_MASK) ? 0 : 1) | ||
860 | + | ||
861 | +/****************************************************************************/ | ||
862 | +/** | ||
863 | +* | ||
864 | +* Set the number of words to be read from the Icap in the Size register. | ||
865 | +* | ||
866 | +* The Size Register holds the number of 32 bit words to transfer from the | ||
867 | +* the Icap to the Read FIFO of the HwIcap device. | ||
868 | +* | ||
869 | +* @param BaseAddress contains the base address of the device. | ||
870 | +* @param Data is the size in words. | ||
871 | +* | ||
872 | +* @return None. | ||
873 | +* | ||
874 | +* @note C-style Signature: | ||
875 | +* void XHwIcap_SetSizeReg(u32 BaseAddress, u32 Data); | ||
876 | +* | ||
877 | +*****************************************************************************/ | ||
878 | +#define XHwIcap_SetSizeReg(BaseAddress, Data) \ | ||
879 | + (XHwIcap_WriteReg(BaseAddress, XHI_SZ_OFFSET, (Data))) | ||
880 | + | ||
881 | +/****************************************************************************/ | ||
882 | +/** | ||
883 | +* | ||
884 | +* Set the Control Register to initiate a ReadBack from the device. | ||
885 | +* | ||
886 | +* @param BaseAddress contains the base address of the device. | ||
887 | +* | ||
888 | +* @return None. | ||
889 | +* | ||
890 | +* @note C-style Signature: | ||
891 | +* void XHwIcap_StartReadBack(u32 BaseAddress); | ||
892 | +* | ||
893 | +*****************************************************************************/ | ||
894 | +#define XHwIcap_StartReadBack(BaseAddress) \ | ||
895 | + (XHwIcap_WriteReg(BaseAddress, XHI_CR_OFFSET, (XHwIcap_GetControlReg(BaseAddress) & \ | ||
896 | + (~ XHI_CR_WRITE_MASK)) | XHI_CR_READ_MASK)) | ||
897 | + | ||
898 | +/****************************************************************************/ | ||
899 | +/** | ||
900 | +* | ||
901 | +* Generates a Type 1 packet header that reads back the requested Configuration | ||
902 | +* register. | ||
903 | +* | ||
904 | +* @param Register is the address of the register to be read back. | ||
905 | +* | ||
906 | +* @return Type 1 packet header to read the specified register | ||
907 | +* | ||
908 | +* @note None. | ||
909 | +* | ||
910 | +*****************************************************************************/ | ||
911 | +#define XHwIcap_Type1Read(Register) \ | ||
912 | + ( (XHI_TYPE_1 << XHI_TYPE_SHIFT) | (Register << XHI_REGISTER_SHIFT) | \ | ||
913 | + (XHI_OP_READ << XHI_OP_SHIFT) ) | ||
914 | + | ||
915 | diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h | ||
916 | index 2c4d5ff..9d19dda 100644 | ||
917 | --- a/arch/microblaze/include/asm/processor.h | ||
918 | +++ b/arch/microblaze/include/asm/processor.h | ||
919 | @@ -31,4 +31,8 @@ extern char __text_start[]; | ||
920 | /* Microblaze board initialization function */ | ||
921 | void board_init(void); | ||
922 | |||
923 | +/* Watchdog functions */ | ||
924 | +int hw_watchdog_init(void); | ||
925 | +void hw_watchdog_disable(void); | ||
926 | + | ||
927 | #endif /* __ASM_MICROBLAZE_PROCESSOR_H */ | ||
928 | diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile | ||
929 | index 7730695..8d7febd 100644 | ||
930 | --- a/arch/microblaze/lib/Makefile | ||
931 | +++ b/arch/microblaze/lib/Makefile | ||
932 | @@ -29,6 +29,7 @@ SOBJS-y += | ||
933 | |||
934 | COBJS-y += board.o | ||
935 | COBJS-y += bootm.o | ||
936 | +COBJS-y += muldi3.o | ||
937 | |||
938 | SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) | ||
939 | OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) | ||
940 | diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c | ||
941 | index a7c2f76..815fb5a 100644 | ||
942 | --- a/arch/microblaze/lib/board.c | ||
943 | +++ b/arch/microblaze/lib/board.c | ||
944 | @@ -61,6 +61,9 @@ init_fnc_t *init_sequence[] = { | ||
945 | serial_init, | ||
946 | console_init_f, | ||
947 | interrupts_init, | ||
948 | +#ifdef CONFIG_XILINX_TB_WATCHDOG | ||
949 | + hw_watchdog_init, | ||
950 | +#endif | ||
951 | timer_init, | ||
952 | NULL, | ||
953 | }; | ||
954 | diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c | ||
955 | index 66d21f4..7da683d 100644 | ||
956 | --- a/arch/microblaze/lib/bootm.c | ||
957 | +++ b/arch/microblaze/lib/bootm.c | ||
958 | @@ -30,6 +30,10 @@ | ||
959 | #include <u-boot/zlib.h> | ||
960 | #include <asm/byteorder.h> | ||
961 | |||
962 | +#if defined(CONFIG_CMD_BOOTB) | ||
963 | +#include <asm/icap.h> | ||
964 | +#endif | ||
965 | + | ||
966 | DECLARE_GLOBAL_DATA_PTR; | ||
967 | |||
968 | int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) | ||
969 | @@ -83,3 +87,62 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||
970 | |||
971 | return 1; | ||
972 | } | ||
973 | + | ||
974 | +#if defined(CONFIG_CMD_BOOTB) | ||
975 | +int do_bootb_kintex7(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
976 | +{ | ||
977 | + u32 FrameBuffer[8]; | ||
978 | + u32 BootAddress = simple_strtoul(argv[1], NULL, 16); | ||
979 | + u32 Index = 0; | ||
980 | + u32 Count; | ||
981 | + | ||
982 | + if (argc < 2) | ||
983 | + return -1; | ||
984 | + | ||
985 | + if ((BootAddress < CONFIG_SYS_FLASH_BASE) || (BootAddress > (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE))) | ||
986 | + { | ||
987 | + return -1; | ||
988 | + } | ||
989 | + | ||
990 | + /* | ||
991 | + * Create the data to be written to the ICAP. | ||
992 | + */ | ||
993 | + FrameBuffer[Index++] = XHI_DUMMY_PACKET; | ||
994 | + FrameBuffer[Index++] = XHI_SYNC_PACKET; | ||
995 | + FrameBuffer[Index++] = XHI_NOOP_PACKET; | ||
996 | + FrameBuffer[Index++] = 0x30020001; /* Type 1 write to WBSTAR */ | ||
997 | + FrameBuffer[Index++] = BootAddress; | ||
998 | + FrameBuffer[Index++] = 0x30008001; /* Type 1 Write to CMD */ | ||
999 | + FrameBuffer[Index++] = XHI_CMD_IPROG; | ||
1000 | + FrameBuffer[Index++] = XHI_NOOP_PACKET; | ||
1001 | + | ||
1002 | + /* | ||
1003 | + * Fill the FIFO with as many words as it will take (or as many as we have to send). | ||
1004 | + */ | ||
1005 | + while(Index > XHwIcap_GetWrFifoVacancy(HWICAP_BASEADDR)); | ||
1006 | + for (Count = 0; Count < Index; Count++) | ||
1007 | + { | ||
1008 | + XHwIcap_FifoWrite(HWICAP_BASEADDR, FrameBuffer[Count]); | ||
1009 | + } | ||
1010 | + | ||
1011 | + /* | ||
1012 | + * Start the transfer of the data from the FIFO to the ICAP device. | ||
1013 | + */ | ||
1014 | + XHwIcap_StartConfig(HWICAP_BASEADDR); | ||
1015 | + | ||
1016 | + while ((XHwIcap_ReadReg(HWICAP_BASEADDR,XHI_CR_OFFSET)) & XHI_CR_WRITE_MASK); | ||
1017 | + | ||
1018 | + while (XHwIcap_IsDeviceBusy(HWICAP_BASEADDR) != 0); | ||
1019 | + while (XHwIcap_ReadReg(HWICAP_BASEADDR, XHI_CR_OFFSET) & XHI_CR_WRITE_MASK); | ||
1020 | + | ||
1021 | + /* The code should never get here sice the FPGA should reset */ | ||
1022 | + return -1; | ||
1023 | +} | ||
1024 | + | ||
1025 | +U_BOOT_CMD( | ||
1026 | + bootb, 2, 1, do_bootb_kintex7, | ||
1027 | + "reprogram the fpga with a new image", | ||
1028 | + "<address> - Program the FPGA with the data starting at the given address" | ||
1029 | +); | ||
1030 | + | ||
1031 | +#endif | ||
1032 | diff --git a/arch/microblaze/lib/muldi3.c b/arch/microblaze/lib/muldi3.c | ||
1033 | new file mode 100644 | ||
1034 | index 0000000..76d7590 | ||
1035 | --- /dev/null | ||
1036 | +++ b/arch/microblaze/lib/muldi3.c | ||
1037 | @@ -0,0 +1,91 @@ | ||
1038 | +/* | ||
1039 | + * U-boot - muldi3.c contains routines for mult and div | ||
1040 | + * | ||
1041 | + * | ||
1042 | + * See file CREDITS for list of people who contributed to this | ||
1043 | + * project. | ||
1044 | + * | ||
1045 | + * This program is free software; you can redistribute it and/or | ||
1046 | + * modify it under the terms of the GNU General Public License as | ||
1047 | + * published by the Free Software Foundation; either version 2 of | ||
1048 | + * the License, or (at your option) any later version. | ||
1049 | + * | ||
1050 | + * This program is distributed in the hope that it will be useful, | ||
1051 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1052 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1053 | + * GNU General Public License for more details. | ||
1054 | + * | ||
1055 | + * You should have received a copy of the GNU General Public License | ||
1056 | + * along with this program; if not, write to the Free Software | ||
1057 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
1058 | + * MA 02110-1301 USA | ||
1059 | + */ | ||
1060 | + | ||
1061 | +/* Generic function got from GNU gcc package, libgcc2.c */ | ||
1062 | +#ifndef SI_TYPE_SIZE | ||
1063 | +#define SI_TYPE_SIZE 32 | ||
1064 | +#endif | ||
1065 | +#define __ll_B (1L << (SI_TYPE_SIZE / 2)) | ||
1066 | +#define __ll_lowpart(t) ((USItype) (t) % __ll_B) | ||
1067 | +#define __ll_highpart(t) ((USItype) (t) / __ll_B) | ||
1068 | +#define BITS_PER_UNIT 8 | ||
1069 | + | ||
1070 | +#if !defined(umul_ppmm) | ||
1071 | +#define umul_ppmm(w1, w0, u, v) \ | ||
1072 | + do { \ | ||
1073 | + USItype __x0, __x1, __x2, __x3; \ | ||
1074 | + USItype __ul, __vl, __uh, __vh; \ | ||
1075 | + \ | ||
1076 | + __ul = __ll_lowpart(u); \ | ||
1077 | + __uh = __ll_highpart(u); \ | ||
1078 | + __vl = __ll_lowpart(v); \ | ||
1079 | + __vh = __ll_highpart(v); \ | ||
1080 | + \ | ||
1081 | + __x0 = (USItype) __ul * __vl; \ | ||
1082 | + __x1 = (USItype) __ul * __vh; \ | ||
1083 | + __x2 = (USItype) __uh * __vl; \ | ||
1084 | + __x3 = (USItype) __uh * __vh; \ | ||
1085 | + \ | ||
1086 | + __x1 += __ll_highpart(__x0); /* this can't give carry */\ | ||
1087 | + __x1 += __x2; /* but this indeed can */ \ | ||
1088 | + if (__x1 < __x2) /* did we get it? */ \ | ||
1089 | + __x3 += __ll_B; /* yes, add it in the proper pos. */ \ | ||
1090 | + \ | ||
1091 | + (w1) = __x3 + __ll_highpart(__x1); \ | ||
1092 | + (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0);\ | ||
1093 | + } while (0) | ||
1094 | +#endif | ||
1095 | + | ||
1096 | +#if !defined(__umulsidi3) | ||
1097 | +#define __umulsidi3(u, v) \ | ||
1098 | + ({DIunion __w; \ | ||
1099 | + umul_ppmm(__w.s.high, __w.s.low, u, v); \ | ||
1100 | + __w.ll; }) | ||
1101 | +#endif | ||
1102 | + | ||
1103 | +typedef unsigned int USItype __attribute__ ((mode(SI))); | ||
1104 | +typedef int SItype __attribute__ ((mode(SI))); | ||
1105 | +typedef int DItype __attribute__ ((mode(DI))); | ||
1106 | +typedef int word_type __attribute__ ((mode(__word__))); | ||
1107 | + | ||
1108 | +struct DIstruct { | ||
1109 | + SItype low, high; | ||
1110 | +}; | ||
1111 | +typedef union { | ||
1112 | + struct DIstruct s; | ||
1113 | + DItype ll; | ||
1114 | +} DIunion; | ||
1115 | + | ||
1116 | +DItype __muldi3(DItype u, DItype v) | ||
1117 | +{ | ||
1118 | + DIunion w; | ||
1119 | + DIunion uu, vv; | ||
1120 | + | ||
1121 | + uu.ll = u, vv.ll = v; | ||
1122 | + /* panic("kernel panic for __muldi3"); */ | ||
1123 | + w.ll = __umulsidi3(uu.s.low, vv.s.low); | ||
1124 | + w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high | ||
1125 | + + (USItype) uu.s.high * (USItype) vv.s.low); | ||
1126 | + | ||
1127 | + return w.ll; | ||
1128 | +} | ||
1129 | -- | ||
1130 | 1.7.5.4 | ||
1131 | |||
diff --git a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0002-Xilinx-modifications-to-boards.patch b/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0002-Xilinx-modifications-to-boards.patch deleted file mode 100644 index abae958c..00000000 --- a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0002-Xilinx-modifications-to-boards.patch +++ /dev/null | |||
@@ -1,3559 +0,0 @@ | |||
1 | From 06c1083022cf78385ca85edb0e7ccf679c8cb40a Mon Sep 17 00:00:00 2001 | ||
2 | From: Sipke Vriend <sipke.vriend@xilinx.com> | ||
3 | Date: Tue, 21 May 2013 07:19:12 +1000 | ||
4 | Subject: [PATCH 2/5] Xilinx modifications to boards | ||
5 | |||
6 | Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> | ||
7 | --- | ||
8 | board/avnet/fx12mm/.gitignore | 1 - | ||
9 | board/avnet/fx12mm/Makefile | 27 -- | ||
10 | board/avnet/fx12mm/fx12mm.c | 51 -- | ||
11 | board/avnet/fx12mm/xparameters.h | 51 -- | ||
12 | board/avnet/v5fx30teval/.gitignore | 1 - | ||
13 | board/avnet/v5fx30teval/Makefile | 27 -- | ||
14 | board/avnet/v5fx30teval/v5fx30teval.c | 28 -- | ||
15 | board/avnet/v5fx30teval/xparameters.h | 33 -- | ||
16 | board/xilinx/common/xbasic_types.c | 88 ++--- | ||
17 | board/xilinx/common/xbasic_types.h | 271 ++++++----- | ||
18 | board/xilinx/common/xstatus.h | 489 ++++++++++++-------- | ||
19 | board/xilinx/microblaze-generic/.gitignore | 5 + | ||
20 | board/xilinx/microblaze-generic/Makefile | 2 +- | ||
21 | board/xilinx/microblaze-generic/config.mk | 34 -- | ||
22 | .../xilinx/microblaze-generic/microblaze-generic.c | 77 +--- | ||
23 | board/xilinx/microblaze-generic/xparameters.h | 79 ---- | ||
24 | board/xilinx/ml507/.gitignore | 1 - | ||
25 | board/xilinx/ml507/Makefile | 27 -- | ||
26 | board/xilinx/ml507/ml507.c | 28 -- | ||
27 | board/xilinx/ml507/xparameters.h | 34 -- | ||
28 | board/xilinx/ppc405-generic/.gitignore | 6 +- | ||
29 | board/xilinx/ppc405-generic/Makefile | 11 +- | ||
30 | board/xilinx/ppc405-generic/ppc405-generic.c | 104 +++++ | ||
31 | board/xilinx/ppc405-generic/u-boot.lds | 132 ++++++ | ||
32 | .../xilinx/ppc405-generic/xilinx_ppc405_generic.c | 59 --- | ||
33 | board/xilinx/ppc405-generic/xparameters.h | 36 -- | ||
34 | board/xilinx/ppc440-generic/.gitignore | 6 +- | ||
35 | board/xilinx/ppc440-generic/Makefile | 13 +- | ||
36 | board/xilinx/ppc440-generic/ppc440-generic.c | 104 +++++ | ||
37 | board/xilinx/ppc440-generic/u-boot.lds | 104 +++++ | ||
38 | .../xilinx/ppc440-generic/xilinx_ppc440_generic.c | 52 -- | ||
39 | board/xilinx/ppc440-generic/xparameters.h | 34 -- | ||
40 | board/xilinx/xilinx_iic/xiic_l.c | 484 ------------------- | ||
41 | board/xilinx/xilinx_iic/xiic_l.h | 150 ------ | ||
42 | board/xilinx/zynq/Makefile | 8 +- | ||
43 | board/xilinx/zynq/board.c | 127 +++++- | ||
44 | boards.cfg | 23 +- | ||
45 | 37 files changed, 1079 insertions(+), 1728 deletions(-) | ||
46 | delete mode 100644 board/avnet/fx12mm/.gitignore | ||
47 | delete mode 100644 board/avnet/fx12mm/Makefile | ||
48 | delete mode 100644 board/avnet/fx12mm/fx12mm.c | ||
49 | delete mode 100644 board/avnet/fx12mm/xparameters.h | ||
50 | delete mode 100644 board/avnet/v5fx30teval/.gitignore | ||
51 | delete mode 100644 board/avnet/v5fx30teval/Makefile | ||
52 | delete mode 100644 board/avnet/v5fx30teval/v5fx30teval.c | ||
53 | delete mode 100644 board/avnet/v5fx30teval/xparameters.h | ||
54 | create mode 100644 board/xilinx/microblaze-generic/.gitignore | ||
55 | delete mode 100644 board/xilinx/microblaze-generic/config.mk | ||
56 | delete mode 100644 board/xilinx/microblaze-generic/xparameters.h | ||
57 | delete mode 100644 board/xilinx/ml507/.gitignore | ||
58 | delete mode 100644 board/xilinx/ml507/Makefile | ||
59 | delete mode 100644 board/xilinx/ml507/ml507.c | ||
60 | delete mode 100644 board/xilinx/ml507/xparameters.h | ||
61 | create mode 100644 board/xilinx/ppc405-generic/ppc405-generic.c | ||
62 | create mode 100644 board/xilinx/ppc405-generic/u-boot.lds | ||
63 | delete mode 100644 board/xilinx/ppc405-generic/xilinx_ppc405_generic.c | ||
64 | delete mode 100644 board/xilinx/ppc405-generic/xparameters.h | ||
65 | create mode 100644 board/xilinx/ppc440-generic/ppc440-generic.c | ||
66 | create mode 100644 board/xilinx/ppc440-generic/u-boot.lds | ||
67 | delete mode 100644 board/xilinx/ppc440-generic/xilinx_ppc440_generic.c | ||
68 | delete mode 100644 board/xilinx/ppc440-generic/xparameters.h | ||
69 | delete mode 100644 board/xilinx/xilinx_iic/xiic_l.c | ||
70 | delete mode 100644 board/xilinx/xilinx_iic/xiic_l.h | ||
71 | |||
72 | diff --git a/board/avnet/fx12mm/.gitignore b/board/avnet/fx12mm/.gitignore | ||
73 | deleted file mode 100644 | ||
74 | index b644f59..0000000 | ||
75 | --- a/board/avnet/fx12mm/.gitignore | ||
76 | +++ /dev/null | ||
77 | @@ -1 +0,0 @@ | ||
78 | -config.tmp | ||
79 | diff --git a/board/avnet/fx12mm/Makefile b/board/avnet/fx12mm/Makefile | ||
80 | deleted file mode 100644 | ||
81 | index f943781..0000000 | ||
82 | --- a/board/avnet/fx12mm/Makefile | ||
83 | +++ /dev/null | ||
84 | @@ -1,27 +0,0 @@ | ||
85 | -# | ||
86 | -# (C) Copyright 2008 | ||
87 | -# Ricardo Ribalda,Universidad Autonoma de Madrid, ricardo.ribalda@uam.es | ||
88 | -# This work has been supported by: Qtechnology http://qtec.com/ | ||
89 | -# | ||
90 | -# See file CREDITS for list of people who contributed to this | ||
91 | -# project. | ||
92 | -# | ||
93 | -# This program is free software; you can redistribute it and/or | ||
94 | -# modify it under the terms of the GNU General Public License as | ||
95 | -# published by the Free Software Foundation; either version 2 of | ||
96 | -# the License, or (at your option) any later version. | ||
97 | -# | ||
98 | -# This program is distributed in the hope that it will be useful, | ||
99 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
100 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
101 | -# GNU General Public License for more details. | ||
102 | -# | ||
103 | -# You should have received a copy of the GNU General Public License | ||
104 | -# along with this program; if not, write to the Free Software | ||
105 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
106 | -# MA 02111-1307 USA | ||
107 | -# | ||
108 | - | ||
109 | -COBJS += $(BOARD).o | ||
110 | - | ||
111 | -include $(SRCTREE)/board/xilinx/ppc405-generic/Makefile | ||
112 | diff --git a/board/avnet/fx12mm/fx12mm.c b/board/avnet/fx12mm/fx12mm.c | ||
113 | deleted file mode 100644 | ||
114 | index c975efa..0000000 | ||
115 | --- a/board/avnet/fx12mm/fx12mm.c | ||
116 | +++ /dev/null | ||
117 | @@ -1,51 +0,0 @@ | ||
118 | -/* | ||
119 | - * (C) Copyright 2008 | ||
120 | - * | ||
121 | - * Author: Xilinx Inc. | ||
122 | - * | ||
123 | - * Modified by: | ||
124 | - * Georg Schardt <schardt@team-ctech.de> | ||
125 | - * | ||
126 | - * See file CREDITS for list of people who contributed to this | ||
127 | - * project. | ||
128 | - * | ||
129 | - * This program is free software; you can redistribute it and/or | ||
130 | - * modify it under the terms of the GNU General Public License as | ||
131 | - * published by the Free Software Foundation; either version 2 of | ||
132 | - * the License, or (at your option) any later version. | ||
133 | - * | ||
134 | - * This program is distributed in the hope that it will be useful, | ||
135 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
136 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
137 | - * GNU General Public License for more details. | ||
138 | - * | ||
139 | - * You should have received a copy of the GNU General Public License | ||
140 | - * along with this program; if not, write to the Free Software | ||
141 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
142 | - * MA 02111-1307 USA | ||
143 | - * | ||
144 | - */ | ||
145 | - | ||
146 | -#include <config.h> | ||
147 | -#include <common.h> | ||
148 | -#include <asm/processor.h> | ||
149 | - | ||
150 | -int checkboard(void) | ||
151 | -{ | ||
152 | - char buf[64]; | ||
153 | - int i; | ||
154 | - int l = getenv_f("serial#", buf, sizeof(buf)); | ||
155 | - | ||
156 | - if (l < 0) { | ||
157 | - printf("Avnet Virtex4 FX12 with no serial #"); | ||
158 | - } else { | ||
159 | - printf("Avnet Virtex4 FX12 Minimodul # "); | ||
160 | - for (i = 0; i < l; ++i) { | ||
161 | - if (buf[i] == ' ') | ||
162 | - break; | ||
163 | - putc(buf[i]); | ||
164 | - } | ||
165 | - } | ||
166 | - putc('\n'); | ||
167 | - return 0; | ||
168 | -} | ||
169 | diff --git a/board/avnet/fx12mm/xparameters.h b/board/avnet/fx12mm/xparameters.h | ||
170 | deleted file mode 100644 | ||
171 | index 4410f19..0000000 | ||
172 | --- a/board/avnet/fx12mm/xparameters.h | ||
173 | +++ /dev/null | ||
174 | @@ -1,51 +0,0 @@ | ||
175 | -/* | ||
176 | - * (C) Copyright 2008 | ||
177 | - * | ||
178 | - * Georg Schardt <schardt@team-ctech.de> | ||
179 | - * | ||
180 | - * See file CREDITS for list of people who contributed to this | ||
181 | - * project. | ||
182 | - * | ||
183 | - * This program is free software; you can redistribute it and/or | ||
184 | - * modify it under the terms of the GNU General Public License as | ||
185 | - * published by the Free Software Foundation; either version 2 of | ||
186 | - * the License, or (at your option) any later version. | ||
187 | - * | ||
188 | - * This program is distributed in the hope that it will be useful, | ||
189 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
190 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
191 | - * GNU General Public License for more details. | ||
192 | - * | ||
193 | - * You should have received a copy of the GNU General Public License | ||
194 | - * along with this program; if not, write to the Free Software | ||
195 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
196 | - * MA 02111-1307 USA | ||
197 | - * | ||
198 | - * CAUTION: This file is based on the xparameters.h automatically | ||
199 | - * generated by libgen. Version: Xilinx EDK 10.1.02 Build EDK_K_SP2.5 | ||
200 | - */ | ||
201 | - | ||
202 | -#ifndef __XPARAMETER_H__ | ||
203 | -#define __XPARAMETER_H__ | ||
204 | - | ||
205 | -/* RS232 */ | ||
206 | -#define XPAR_UARTNS550_0_CLOCK_FREQ_HZ 100000000 | ||
207 | -#define XPAR_UARTNS550_0_BASEADDR 0x83E00000 | ||
208 | - | ||
209 | - | ||
210 | -/* INT_C */ | ||
211 | -#define XPAR_XPS_INTC_0_DEVICE_ID 0 | ||
212 | -#define XPAR_XPS_INTC_0_BASEADDR 0x81800000 | ||
213 | -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 2 | ||
214 | - | ||
215 | -/* CPU core clock */ | ||
216 | -#define XPAR_CORE_CLOCK_FREQ_HZ 300000000 | ||
217 | -#define XPAR_PLB_CLOCK_FREQ_HZ 100000000 | ||
218 | - | ||
219 | -/* RAM */ | ||
220 | -#define XPAR_DDR2_SDRAM_MEM_BASEADDR 0x00000000 | ||
221 | - | ||
222 | -/* FLASH */ | ||
223 | -#define XPAR_FLASH_MEM0_BASEADDR 0xFFC00000 | ||
224 | - | ||
225 | -#endif | ||
226 | diff --git a/board/avnet/v5fx30teval/.gitignore b/board/avnet/v5fx30teval/.gitignore | ||
227 | deleted file mode 100644 | ||
228 | index f6418a0..0000000 | ||
229 | --- a/board/avnet/v5fx30teval/.gitignore | ||
230 | +++ /dev/null | ||
231 | @@ -1 +0,0 @@ | ||
232 | -/config.tmp | ||
233 | diff --git a/board/avnet/v5fx30teval/Makefile b/board/avnet/v5fx30teval/Makefile | ||
234 | deleted file mode 100644 | ||
235 | index de23f29..0000000 | ||
236 | --- a/board/avnet/v5fx30teval/Makefile | ||
237 | +++ /dev/null | ||
238 | @@ -1,27 +0,0 @@ | ||
239 | -# | ||
240 | -# (C) Copyright 2008 | ||
241 | -# Ricardo Ribalda,Universidad Autonoma de Madrid, ricardo.ribalda@uam.es | ||
242 | -# This work has been supported by: Qtechnology http://qtec.com/ | ||
243 | -# | ||
244 | -# See file CREDITS for list of people who contributed to this | ||
245 | -# project. | ||
246 | -# | ||
247 | -# This program is free software; you can redistribute it and/or | ||
248 | -# modify it under the terms of the GNU General Public License as | ||
249 | -# published by the Free Software Foundation; either version 2 of | ||
250 | -# the License, or (at your option) any later version. | ||
251 | -# | ||
252 | -# This program is distributed in the hope that it will be useful, | ||
253 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
254 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
255 | -# GNU General Public License for more details. | ||
256 | -# | ||
257 | -# You should have received a copy of the GNU General Public License | ||
258 | -# along with this program; if not, write to the Free Software | ||
259 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
260 | -# MA 02111-1307 USA | ||
261 | -# | ||
262 | - | ||
263 | -COBJS += $(BOARD).o | ||
264 | - | ||
265 | -include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile | ||
266 | diff --git a/board/avnet/v5fx30teval/v5fx30teval.c b/board/avnet/v5fx30teval/v5fx30teval.c | ||
267 | deleted file mode 100644 | ||
268 | index 14a1d5d..0000000 | ||
269 | --- a/board/avnet/v5fx30teval/v5fx30teval.c | ||
270 | +++ /dev/null | ||
271 | @@ -1,28 +0,0 @@ | ||
272 | -/* | ||
273 | - * (C) Copyright 2008 | ||
274 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
275 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
276 | - * This program is free software: you can redistribute it and/or modify | ||
277 | - * it under the terms of the GNU General Public License as published by | ||
278 | - * the Free Software Foundation, either version 2 of the License, or | ||
279 | - * (at your option) any later version. | ||
280 | - * | ||
281 | - * This program is distributed in the hope that it will be useful, | ||
282 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
283 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
284 | - * GNU General Public License for more details. | ||
285 | - * | ||
286 | - * You should have received a copy of the GNU General Public License | ||
287 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
288 | -*/ | ||
289 | - | ||
290 | -#include <config.h> | ||
291 | -#include <common.h> | ||
292 | -#include <asm/processor.h> | ||
293 | - | ||
294 | - | ||
295 | -int checkboard(void) | ||
296 | -{ | ||
297 | - puts("Avnet Virtex 5 FX30 Evaluation Board\n"); | ||
298 | - return 0; | ||
299 | -} | ||
300 | diff --git a/board/avnet/v5fx30teval/xparameters.h b/board/avnet/v5fx30teval/xparameters.h | ||
301 | deleted file mode 100644 | ||
302 | index bb657fc..0000000 | ||
303 | --- a/board/avnet/v5fx30teval/xparameters.h | ||
304 | +++ /dev/null | ||
305 | @@ -1,33 +0,0 @@ | ||
306 | -/* | ||
307 | - * (C) Copyright 2008 | ||
308 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
309 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
310 | - * based on xparameters.h by Xilinx | ||
311 | - * | ||
312 | - * This program is free software: you can redistribute it and/or modify | ||
313 | - * it under the terms of the GNU General Public License as published by | ||
314 | - * the Free Software Foundation, either version 2 of the License, or | ||
315 | - * (at your option) any later version. | ||
316 | - * | ||
317 | - * This program is distributed in the hope that it will be useful, | ||
318 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
319 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
320 | - * GNU General Public License for more details. | ||
321 | - * | ||
322 | - * You should have received a copy of the GNU General Public License | ||
323 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
324 | -*/ | ||
325 | - | ||
326 | -#ifndef XPARAMETER_H | ||
327 | -#define XPARAMETER_H | ||
328 | - | ||
329 | -#define XPAR_DDR2_SDRAM_MEM_BASEADDR 0x00000000 | ||
330 | -#define XPAR_INTC_0_BASEADDR 0x81800000 | ||
331 | -#define XPAR_UARTLITE_0_BASEADDR 0x84000000 | ||
332 | -#define XPAR_FLASH_MEM0_BASEADDR 0xFF000000 | ||
333 | -#define XPAR_PLB_CLOCK_FREQ_HZ 100000000 | ||
334 | -#define XPAR_CORE_CLOCK_FREQ_HZ 400000000 | ||
335 | -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 13 | ||
336 | -#define XPAR_UARTLITE_0_BAUDRATE 9600 | ||
337 | - | ||
338 | -#endif | ||
339 | diff --git a/board/xilinx/common/xbasic_types.c b/board/xilinx/common/xbasic_types.c | ||
340 | index c3a171a..7a80347 100644 | ||
341 | --- a/board/xilinx/common/xbasic_types.c | ||
342 | +++ b/board/xilinx/common/xbasic_types.c | ||
343 | @@ -1,39 +1,22 @@ | ||
344 | +/* $Id $ */ | ||
345 | /****************************************************************************** | ||
346 | * | ||
347 | -* Author: Xilinx, Inc. | ||
348 | -* | ||
349 | -* | ||
350 | -* This program is free software; you can redistribute it and/or modify it | ||
351 | -* under the terms of the GNU General Public License as published by the | ||
352 | -* Free Software Foundation; either version 2 of the License, or (at your | ||
353 | -* option) any later version. | ||
354 | -* | ||
355 | -* | ||
356 | -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A | ||
357 | -* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS | ||
358 | -* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, | ||
359 | -* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE | ||
360 | -* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING | ||
361 | -* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. | ||
362 | -* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO | ||
363 | -* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY | ||
364 | -* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM | ||
365 | -* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
366 | -* FITNESS FOR A PARTICULAR PURPOSE. | ||
367 | -* | ||
368 | -* | ||
369 | -* Xilinx hardware products are not intended for use in life support | ||
370 | -* appliances, devices, or systems. Use in such applications is | ||
371 | -* expressly prohibited. | ||
372 | -* | ||
373 | -* | ||
374 | -* (c) Copyright 2002-2004 Xilinx Inc. | ||
375 | -* All rights reserved. | ||
376 | -* | ||
377 | - * | ||
378 | -* You should have received a copy of the GNU General Public License along | ||
379 | -* with this program; if not, write to the Free Software Foundation, Inc., | ||
380 | -* 675 Mass Ave, Cambridge, MA 02139, USA. | ||
381 | +* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" | ||
382 | +* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND | ||
383 | +* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, | ||
384 | +* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, | ||
385 | +* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION | ||
386 | +* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, | ||
387 | +* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE | ||
388 | +* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY | ||
389 | +* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE | ||
390 | +* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR | ||
391 | +* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF | ||
392 | +* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
393 | +* FOR A PARTICULAR PURPOSE. | ||
394 | +* | ||
395 | +* (c) Copyright 2002-2003 Xilinx Inc. | ||
396 | +* All rights reserved. | ||
397 | * | ||
398 | ******************************************************************************/ | ||
399 | /*****************************************************************************/ | ||
400 | @@ -49,6 +32,7 @@ | ||
401 | * Ver Who Date Changes | ||
402 | * ----- ---- -------- ------------------------------------------------------- | ||
403 | * 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler | ||
404 | +* 1.00a xd 11/03/04 Improved support for doxygen. | ||
405 | * </pre> | ||
406 | * | ||
407 | ******************************************************************************/ | ||
408 | @@ -77,7 +61,7 @@ unsigned int XAssertStatus; | ||
409 | * such that it does not wait infinitely. Use the debugger to disable the | ||
410 | * waiting during testing of asserts. | ||
411 | */ | ||
412 | -u32 XWaitInAssert = TRUE; | ||
413 | +int XWaitInAssert = TRUE; | ||
414 | |||
415 | /* The callback function to be invoked when an assert is taken */ | ||
416 | static XAssertCallback XAssertCallbackRoutine = (XAssertCallback) NULL; | ||
417 | @@ -94,17 +78,12 @@ static XAssertCallback XAssertCallbackRoutine = (XAssertCallback) NULL; | ||
418 | * @param File is the name of the filename of the source | ||
419 | * @param Line is the linenumber within File | ||
420 | * | ||
421 | -* @return | ||
422 | -* | ||
423 | -* None. | ||
424 | +* @return None. | ||
425 | * | ||
426 | -* @note | ||
427 | -* | ||
428 | -* None. | ||
429 | +* @note None. | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | -void | ||
433 | -XAssert(char *File, int Line) | ||
434 | +void XAssert(char *File, int Line) | ||
435 | { | ||
436 | /* if the callback has been set then invoke it */ | ||
437 | if (XAssertCallbackRoutine != NULL) { | ||
438 | @@ -126,21 +105,17 @@ XAssert(char *File, int Line) | ||
439 | * | ||
440 | * @param Routine is the callback to be invoked when an assert is taken | ||
441 | * | ||
442 | -* @return | ||
443 | -* | ||
444 | -* None. | ||
445 | +* @return None. | ||
446 | * | ||
447 | -* @note | ||
448 | -* | ||
449 | -* This function has no effect if NDEBUG is set | ||
450 | +* @note This function has no effect if NDEBUG is set | ||
451 | * | ||
452 | ******************************************************************************/ | ||
453 | -void | ||
454 | -XAssertSetCallback(XAssertCallback Routine) | ||
455 | +void XAssertSetCallback(XAssertCallback Routine) | ||
456 | { | ||
457 | XAssertCallbackRoutine = Routine; | ||
458 | } | ||
459 | |||
460 | + | ||
461 | /*****************************************************************************/ | ||
462 | /** | ||
463 | * | ||
464 | @@ -150,16 +125,11 @@ XAssertSetCallback(XAssertCallback Routine) | ||
465 | * | ||
466 | * @param NullParameter is an arbitrary void pointer and not used. | ||
467 | * | ||
468 | -* @return | ||
469 | -* | ||
470 | -* None. | ||
471 | -* | ||
472 | -* @note | ||
473 | +* @return None. | ||
474 | * | ||
475 | -* None. | ||
476 | +* @note None. | ||
477 | * | ||
478 | ******************************************************************************/ | ||
479 | -void | ||
480 | -XNullHandler(void *NullParameter) | ||
481 | +void XNullHandler(void *NullParameter) | ||
482 | { | ||
483 | } | ||
484 | diff --git a/board/xilinx/common/xbasic_types.h b/board/xilinx/common/xbasic_types.h | ||
485 | index ef0b7c2..dd118be 100644 | ||
486 | --- a/board/xilinx/common/xbasic_types.h | ||
487 | +++ b/board/xilinx/common/xbasic_types.h | ||
488 | @@ -1,39 +1,22 @@ | ||
489 | +/* $Id: xbasic_types.h,v 1.1.2.1 2009/05/19 14:56:55 meinelte Exp $ */ | ||
490 | /****************************************************************************** | ||
491 | * | ||
492 | -* Author: Xilinx, Inc. | ||
493 | -* | ||
494 | -* | ||
495 | -* This program is free software; you can redistribute it and/or modify it | ||
496 | -* under the terms of the GNU General Public License as published by the | ||
497 | -* Free Software Foundation; either version 2 of the License, or (at your | ||
498 | -* option) any later version. | ||
499 | -* | ||
500 | -* | ||
501 | -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A | ||
502 | -* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS | ||
503 | -* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, | ||
504 | -* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE | ||
505 | -* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING | ||
506 | -* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. | ||
507 | -* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO | ||
508 | -* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY | ||
509 | -* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM | ||
510 | -* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
511 | -* FITNESS FOR A PARTICULAR PURPOSE. | ||
512 | -* | ||
513 | -* | ||
514 | -* Xilinx hardware products are not intended for use in life support | ||
515 | -* appliances, devices, or systems. Use in such applications is | ||
516 | -* expressly prohibited. | ||
517 | -* | ||
518 | -* | ||
519 | -* (c) Copyright 2002-2004 Xilinx Inc. | ||
520 | -* All rights reserved. | ||
521 | -* | ||
522 | -* | ||
523 | -* You should have received a copy of the GNU General Public License along | ||
524 | -* with this program; if not, write to the Free Software Foundation, Inc., | ||
525 | -* 675 Mass Ave, Cambridge, MA 02139, USA. | ||
526 | +* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" | ||
527 | +* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND | ||
528 | +* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, | ||
529 | +* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, | ||
530 | +* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION | ||
531 | +* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, | ||
532 | +* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE | ||
533 | +* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY | ||
534 | +* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE | ||
535 | +* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR | ||
536 | +* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF | ||
537 | +* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
538 | +* FOR A PARTICULAR PURPOSE. | ||
539 | +* | ||
540 | +* (c) Copyright 2002-2007 Xilinx Inc. | ||
541 | +* All rights reserved. | ||
542 | * | ||
543 | ******************************************************************************/ | ||
544 | /*****************************************************************************/ | ||
545 | @@ -52,45 +35,61 @@ | ||
546 | * <pre> | ||
547 | * MODIFICATION HISTORY: | ||
548 | * | ||
549 | -* Ver Who Date Changes | ||
550 | +* Ver Who Date Changes | ||
551 | * ----- ---- -------- ------------------------------------------------------- | ||
552 | * 1.00a rmm 12/14/01 First release | ||
553 | -* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab | ||
554 | -* compiler warnings | ||
555 | +* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab | ||
556 | +* compiler warnings | ||
557 | * 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler | ||
558 | +* 1.00a rpm 07/21/04 Added XExceptionHandler typedef for processor exceptions | ||
559 | +* 1.00a xd 11/03/04 Improved support for doxygen. | ||
560 | +* 1.00a wre 01/25/07 Added Linux style data types u32, u16, u8, TRUE, FALSE | ||
561 | +* 1.00a rpm 04/02/07 Added ifndef KERNEL around u32, u16, u8 data types | ||
562 | * </pre> | ||
563 | * | ||
564 | ******************************************************************************/ | ||
565 | |||
566 | -#ifndef XBASIC_TYPES_H /* prevent circular inclusions */ | ||
567 | -#define XBASIC_TYPES_H /* by using protection macros */ | ||
568 | +#ifndef XBASIC_TYPES_H /* prevent circular inclusions */ | ||
569 | +#define XBASIC_TYPES_H /* by using protection macros */ | ||
570 | + | ||
571 | +#ifdef __cplusplus | ||
572 | +extern "C" { | ||
573 | +#endif | ||
574 | + | ||
575 | |||
576 | /***************************** Include Files *********************************/ | ||
577 | |||
578 | + | ||
579 | /************************** Constant Definitions *****************************/ | ||
580 | |||
581 | #ifndef TRUE | ||
582 | -#define TRUE 1 | ||
583 | +# define TRUE 1 | ||
584 | #endif | ||
585 | + | ||
586 | #ifndef FALSE | ||
587 | -#define FALSE 0 | ||
588 | +# define FALSE 0 | ||
589 | #endif | ||
590 | |||
591 | #ifndef NULL | ||
592 | -#define NULL 0 | ||
593 | +#define NULL 0 | ||
594 | #endif | ||
595 | -/** Null */ | ||
596 | |||
597 | -#define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */ | ||
598 | -#define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */ | ||
599 | +/** Xilinx NULL, TRUE and FALSE legacy support. Deprecated. */ | ||
600 | +#define XNULL NULL | ||
601 | +#define XTRUE TRUE | ||
602 | +#define XFALSE FALSE | ||
603 | + | ||
604 | + | ||
605 | +#define XCOMPONENT_IS_READY 0x11111111 /**< component has been initialized */ | ||
606 | +#define XCOMPONENT_IS_STARTED 0x22222222 /**< component has been started */ | ||
607 | |||
608 | /* the following constants and declarations are for unit test purposes and are | ||
609 | * designed to be used in test applications. | ||
610 | */ | ||
611 | -#define XTEST_PASSED 0 | ||
612 | -#define XTEST_FAILED 1 | ||
613 | +#define XTEST_PASSED 0 | ||
614 | +#define XTEST_FAILED 1 | ||
615 | |||
616 | -#define XASSERT_NONE 0 | ||
617 | +#define XASSERT_NONE 0 | ||
618 | #define XASSERT_OCCURRED 1 | ||
619 | |||
620 | extern unsigned int XAssertStatus; | ||
621 | @@ -98,18 +97,38 @@ extern void XAssert(char *, int); | ||
622 | |||
623 | /**************************** Type Definitions *******************************/ | ||
624 | |||
625 | -/** @name Primitive types | ||
626 | - * These primitive types are created for transportability. | ||
627 | - * They are dependent upon the target architecture. | ||
628 | +/** @name Legacy types | ||
629 | + * Deprecated legacy types. | ||
630 | * @{ | ||
631 | */ | ||
632 | -#include <linux/types.h> | ||
633 | +typedef unsigned char Xuint8; /**< unsigned 8-bit */ | ||
634 | +typedef char Xint8; /**< signed 8-bit */ | ||
635 | +typedef unsigned short Xuint16; /**< unsigned 16-bit */ | ||
636 | +typedef short Xint16; /**< signed 16-bit */ | ||
637 | +typedef unsigned long Xuint32; /**< unsigned 32-bit */ | ||
638 | +typedef long Xint32; /**< signed 32-bit */ | ||
639 | +typedef float Xfloat32; /**< 32-bit floating point */ | ||
640 | +typedef double Xfloat64; /**< 64-bit double precision FP */ | ||
641 | +typedef unsigned long Xboolean; /**< boolean (XTRUE or XFALSE) */ | ||
642 | |||
643 | -typedef struct { | ||
644 | - u32 Upper; | ||
645 | - u32 Lower; | ||
646 | +typedef struct | ||
647 | +{ | ||
648 | + Xuint32 Upper; | ||
649 | + Xuint32 Lower; | ||
650 | } Xuint64; | ||
651 | |||
652 | +/** @name New types | ||
653 | + * New simple types. | ||
654 | + * @{ | ||
655 | + */ | ||
656 | +#ifndef __KERNEL__ | ||
657 | +typedef Xuint32 u32; | ||
658 | +typedef Xuint16 u16; | ||
659 | +typedef Xuint8 u8; | ||
660 | +#else | ||
661 | +#include <linux/types.h> | ||
662 | +#endif | ||
663 | + | ||
664 | /*@}*/ | ||
665 | |||
666 | /** | ||
667 | @@ -119,6 +138,12 @@ typedef struct { | ||
668 | typedef void (*XInterruptHandler) (void *InstancePtr); | ||
669 | |||
670 | /** | ||
671 | + * This data type defines an exception handler for a processor. | ||
672 | + * The argument points to the instance of the component | ||
673 | + */ | ||
674 | +typedef void (*XExceptionHandler) (void *InstancePtr); | ||
675 | + | ||
676 | +/** | ||
677 | * This data type defines a callback to be invoked when an | ||
678 | * assert occurs. The callback is invoked only when asserts are enabled | ||
679 | */ | ||
680 | @@ -130,15 +155,11 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
681 | /** | ||
682 | * Return the most significant half of the 64 bit data type. | ||
683 | * | ||
684 | -* @param x is the 64 bit word. | ||
685 | +* @param x is the 64 bit word. | ||
686 | * | ||
687 | -* @return | ||
688 | +* @return The upper 32 bits of the 64 bit word. | ||
689 | * | ||
690 | -* The upper 32 bits of the 64 bit word. | ||
691 | -* | ||
692 | -* @note | ||
693 | -* | ||
694 | -* None. | ||
695 | +* @note None. | ||
696 | * | ||
697 | ******************************************************************************/ | ||
698 | #define XUINT64_MSW(x) ((x).Upper) | ||
699 | @@ -147,19 +168,16 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
700 | /** | ||
701 | * Return the least significant half of the 64 bit data type. | ||
702 | * | ||
703 | -* @param x is the 64 bit word. | ||
704 | -* | ||
705 | -* @return | ||
706 | +* @param x is the 64 bit word. | ||
707 | * | ||
708 | -* The lower 32 bits of the 64 bit word. | ||
709 | +* @return The lower 32 bits of the 64 bit word. | ||
710 | * | ||
711 | -* @note | ||
712 | -* | ||
713 | -* None. | ||
714 | +* @note None. | ||
715 | * | ||
716 | ******************************************************************************/ | ||
717 | #define XUINT64_LSW(x) ((x).Lower) | ||
718 | |||
719 | + | ||
720 | #ifndef NDEBUG | ||
721 | |||
722 | /*****************************************************************************/ | ||
723 | @@ -168,28 +186,27 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
724 | * (void). This in conjunction with the XWaitInAssert boolean can be used to | ||
725 | * accomodate tests so that asserts which fail allow execution to continue. | ||
726 | * | ||
727 | -* @param expression is the expression to evaluate. If it evaluates to false, | ||
728 | -* the assert occurs. | ||
729 | -* | ||
730 | -* @return | ||
731 | +* @param expression is the expression to evaluate. If it evaluates to | ||
732 | +* false, the assert occurs. | ||
733 | * | ||
734 | -* Returns void unless the XWaitInAssert variable is true, in which case | ||
735 | -* no return is made and an infinite loop is entered. | ||
736 | +* @return Returns void unless the XWaitInAssert variable is true, in which | ||
737 | +* case no return is made and an infinite loop is entered. | ||
738 | * | ||
739 | -* @note | ||
740 | -* | ||
741 | -* None. | ||
742 | +* @note None. | ||
743 | * | ||
744 | ******************************************************************************/ | ||
745 | -#define XASSERT_VOID(expression) \ | ||
746 | -{ \ | ||
747 | - if (expression) { \ | ||
748 | - XAssertStatus = XASSERT_NONE; \ | ||
749 | - } else { \ | ||
750 | - XAssert(__FILE__, __LINE__); \ | ||
751 | - XAssertStatus = XASSERT_OCCURRED; \ | ||
752 | - return; \ | ||
753 | - } \ | ||
754 | +#define XASSERT_VOID(expression) \ | ||
755 | +{ \ | ||
756 | + if (expression) \ | ||
757 | + { \ | ||
758 | + XAssertStatus = XASSERT_NONE; \ | ||
759 | + } \ | ||
760 | + else \ | ||
761 | + { \ | ||
762 | + XAssert(__FILE__, __LINE__); \ | ||
763 | + XAssertStatus = XASSERT_OCCURRED; \ | ||
764 | + return; \ | ||
765 | + } \ | ||
766 | } | ||
767 | |||
768 | /*****************************************************************************/ | ||
769 | @@ -198,28 +215,27 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
770 | * conjunction with the XWaitInAssert boolean can be used to accomodate tests so | ||
771 | * that asserts which fail allow execution to continue. | ||
772 | * | ||
773 | -* @param expression is the expression to evaluate. If it evaluates to false, | ||
774 | -* the assert occurs. | ||
775 | +* @param expression is the expression to evaluate. If it evaluates to false, | ||
776 | +* the assert occurs. | ||
777 | * | ||
778 | -* @return | ||
779 | +* @return Returns 0 unless the XWaitInAssert variable is true, in which case | ||
780 | +* no return is made and an infinite loop is entered. | ||
781 | * | ||
782 | -* Returns 0 unless the XWaitInAssert variable is true, in which case | ||
783 | -* no return is made and an infinite loop is entered. | ||
784 | -* | ||
785 | -* @note | ||
786 | -* | ||
787 | -* None. | ||
788 | +* @note None. | ||
789 | * | ||
790 | ******************************************************************************/ | ||
791 | -#define XASSERT_NONVOID(expression) \ | ||
792 | -{ \ | ||
793 | - if (expression) { \ | ||
794 | - XAssertStatus = XASSERT_NONE; \ | ||
795 | - } else { \ | ||
796 | - XAssert(__FILE__, __LINE__); \ | ||
797 | - XAssertStatus = XASSERT_OCCURRED; \ | ||
798 | - return 0; \ | ||
799 | - } \ | ||
800 | +#define XASSERT_NONVOID(expression) \ | ||
801 | +{ \ | ||
802 | + if (expression) \ | ||
803 | + { \ | ||
804 | + XAssertStatus = XASSERT_NONE; \ | ||
805 | + } \ | ||
806 | + else \ | ||
807 | + { \ | ||
808 | + XAssert(__FILE__, __LINE__); \ | ||
809 | + XAssertStatus = XASSERT_OCCURRED; \ | ||
810 | + return 0; \ | ||
811 | + } \ | ||
812 | } | ||
813 | |||
814 | /*****************************************************************************/ | ||
815 | @@ -228,21 +244,17 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
816 | * return anything (void). Use for instances where an assert should always | ||
817 | * occur. | ||
818 | * | ||
819 | -* @return | ||
820 | -* | ||
821 | -* Returns void unless the XWaitInAssert variable is true, in which case | ||
822 | -* no return is made and an infinite loop is entered. | ||
823 | +* @return Returns void unless the XWaitInAssert variable is true, in which case | ||
824 | +* no return is made and an infinite loop is entered. | ||
825 | * | ||
826 | -* @note | ||
827 | -* | ||
828 | -* None. | ||
829 | +* @note None. | ||
830 | * | ||
831 | ******************************************************************************/ | ||
832 | -#define XASSERT_VOID_ALWAYS() \ | ||
833 | -{ \ | ||
834 | - XAssert(__FILE__, __LINE__); \ | ||
835 | - XAssertStatus = XASSERT_OCCURRED; \ | ||
836 | - return; \ | ||
837 | +#define XASSERT_VOID_ALWAYS() \ | ||
838 | +{ \ | ||
839 | + XAssert(__FILE__, __LINE__); \ | ||
840 | + XAssertStatus = XASSERT_OCCURRED; \ | ||
841 | + return; \ | ||
842 | } | ||
843 | |||
844 | /*****************************************************************************/ | ||
845 | @@ -250,23 +262,20 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
846 | * Always assert. This assert macro is to be used for functions that do return | ||
847 | * a value. Use for instances where an assert should always occur. | ||
848 | * | ||
849 | -* @return | ||
850 | -* | ||
851 | -* Returns void unless the XWaitInAssert variable is true, in which case | ||
852 | -* no return is made and an infinite loop is entered. | ||
853 | +* @return Returns void unless the XWaitInAssert variable is true, in which case | ||
854 | +* no return is made and an infinite loop is entered. | ||
855 | * | ||
856 | -* @note | ||
857 | -* | ||
858 | -* None. | ||
859 | +* @note None. | ||
860 | * | ||
861 | ******************************************************************************/ | ||
862 | -#define XASSERT_NONVOID_ALWAYS() \ | ||
863 | -{ \ | ||
864 | - XAssert(__FILE__, __LINE__); \ | ||
865 | - XAssertStatus = XASSERT_OCCURRED; \ | ||
866 | - return 0; \ | ||
867 | +#define XASSERT_NONVOID_ALWAYS() \ | ||
868 | +{ \ | ||
869 | + XAssert(__FILE__, __LINE__); \ | ||
870 | + XAssertStatus = XASSERT_OCCURRED; \ | ||
871 | + return 0; \ | ||
872 | } | ||
873 | |||
874 | + | ||
875 | #else | ||
876 | |||
877 | #define XASSERT_VOID(expression) | ||
878 | @@ -280,4 +289,8 @@ typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber); | ||
879 | void XAssertSetCallback(XAssertCallback Routine); | ||
880 | void XNullHandler(void *NullParameter); | ||
881 | |||
882 | +#ifdef __cplusplus | ||
883 | +} | ||
884 | +#endif | ||
885 | + | ||
886 | #endif /* end of protection macro */ | ||
887 | diff --git a/board/xilinx/common/xstatus.h b/board/xilinx/common/xstatus.h | ||
888 | index ffda4d7..6808afc 100644 | ||
889 | --- a/board/xilinx/common/xstatus.h | ||
890 | +++ b/board/xilinx/common/xstatus.h | ||
891 | @@ -1,39 +1,42 @@ | ||
892 | +/* $Id: xstatus.h,v 1.1.2.1 2010/01/07 06:11:50 sadanan Exp $ */ | ||
893 | /****************************************************************************** | ||
894 | * | ||
895 | -* Author: Xilinx, Inc. | ||
896 | +* (c) Copyright 2002-2009 Xilinx, Inc. All rights reserved. | ||
897 | * | ||
898 | +* This file contains confidential and proprietary information of Xilinx, Inc. | ||
899 | +* and is protected under U.S. and international copyright and other | ||
900 | +* intellectual property laws. | ||
901 | * | ||
902 | -* This program is free software; you can redistribute it and/or modify it | ||
903 | -* under the terms of the GNU General Public License as published by the | ||
904 | -* Free Software Foundation; either version 2 of the License, or (at your | ||
905 | -* option) any later version. | ||
906 | +* DISCLAIMER | ||
907 | +* This disclaimer is not a license and does not grant any rights to the | ||
908 | +* materials distributed herewith. Except as otherwise provided in a valid | ||
909 | +* license issued to you by Xilinx, and to the maximum extent permitted by | ||
910 | +* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL | ||
911 | +* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, | ||
912 | +* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF | ||
913 | +* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; | ||
914 | +* and (2) Xilinx shall not be liable (whether in contract or tort, including | ||
915 | +* negligence, or under any other theory of liability) for any loss or damage | ||
916 | +* of any kind or nature related to, arising under or in connection with these | ||
917 | +* materials, including for any direct, or any indirect, special, incidental, | ||
918 | +* or consequential loss or damage (including loss of data, profits, goodwill, | ||
919 | +* or any type of loss or damage suffered as a result of any action brought by | ||
920 | +* a third party) even if such damage or loss was reasonably foreseeable or | ||
921 | +* Xilinx had been advised of the possibility of the same. | ||
922 | * | ||
923 | +* CRITICAL APPLICATIONS | ||
924 | +* Xilinx products are not designed or intended to be fail-safe, or for use in | ||
925 | +* any application requiring fail-safe performance, such as life-support or | ||
926 | +* safety devices or systems, Class III medical devices, nuclear facilities, | ||
927 | +* applications related to the deployment of airbags, or any other applications | ||
928 | +* that could lead to death, personal injury, or severe property or | ||
929 | +* environmental damage (individually and collectively, "Critical | ||
930 | +* Applications"). Customer assumes the sole risk and liability of any use of | ||
931 | +* Xilinx products in Critical Applications, subject only to applicable laws | ||
932 | +* and regulations governing limitations on product liability. | ||
933 | * | ||
934 | -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A | ||
935 | -* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS | ||
936 | -* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, | ||
937 | -* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE | ||
938 | -* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING | ||
939 | -* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. | ||
940 | -* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO | ||
941 | -* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY | ||
942 | -* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM | ||
943 | -* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
944 | -* FITNESS FOR A PARTICULAR PURPOSE. | ||
945 | -* | ||
946 | -* | ||
947 | -* Xilinx hardware products are not intended for use in life support | ||
948 | -* appliances, devices, or systems. Use in such applications is | ||
949 | -* expressly prohibited. | ||
950 | -* | ||
951 | -* | ||
952 | -* (c) Copyright 2002-2004 Xilinx Inc. | ||
953 | -* All rights reserved. | ||
954 | -* | ||
955 | -* | ||
956 | -* You should have received a copy of the GNU General Public License along | ||
957 | -* with this program; if not, write to the Free Software Foundation, Inc., | ||
958 | -* 675 Mass Ave, Cambridge, MA 02139, USA. | ||
959 | +* THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE | ||
960 | +* AT ALL TIMES. | ||
961 | * | ||
962 | ******************************************************************************/ | ||
963 | /*****************************************************************************/ | ||
964 | @@ -42,7 +45,7 @@ | ||
965 | * @file xstatus.h | ||
966 | * | ||
967 | * This file contains Xilinx software status codes. Status codes have their | ||
968 | -* own data type called XStatus. These codes are used throughout the Xilinx | ||
969 | +* own data type called int. These codes are used throughout the Xilinx | ||
970 | * device drivers. | ||
971 | * | ||
972 | ******************************************************************************/ | ||
973 | @@ -50,298 +53,376 @@ | ||
974 | #ifndef XSTATUS_H /* prevent circular inclusions */ | ||
975 | #define XSTATUS_H /* by using protection macros */ | ||
976 | |||
977 | +#ifdef __cplusplus | ||
978 | +extern "C" { | ||
979 | +#endif | ||
980 | + | ||
981 | /***************************** Include Files *********************************/ | ||
982 | |||
983 | +#ifdef NOTNOW | ||
984 | +#include "xil_types.h" | ||
985 | +#include "xil_assert.h" | ||
986 | +#else | ||
987 | #include "xbasic_types.h" | ||
988 | +#endif | ||
989 | |||
990 | /************************** Constant Definitions *****************************/ | ||
991 | |||
992 | /*********************** Common statuses 0 - 500 *****************************/ | ||
993 | |||
994 | -#define XST_SUCCESS 0L | ||
995 | -#define XST_FAILURE 1L | ||
996 | -#define XST_DEVICE_NOT_FOUND 2L | ||
997 | -#define XST_DEVICE_BLOCK_NOT_FOUND 3L | ||
998 | -#define XST_INVALID_VERSION 4L | ||
999 | -#define XST_DEVICE_IS_STARTED 5L | ||
1000 | -#define XST_DEVICE_IS_STOPPED 6L | ||
1001 | -#define XST_FIFO_ERROR 7L /* an error occurred during an | ||
1002 | +#define XST_SUCCESS 0L | ||
1003 | +#define XST_FAILURE 1L | ||
1004 | +#define XST_DEVICE_NOT_FOUND 2L | ||
1005 | +#define XST_DEVICE_BLOCK_NOT_FOUND 3L | ||
1006 | +#define XST_INVALID_VERSION 4L | ||
1007 | +#define XST_DEVICE_IS_STARTED 5L | ||
1008 | +#define XST_DEVICE_IS_STOPPED 6L | ||
1009 | +#define XST_FIFO_ERROR 7L /* an error occurred during an | ||
1010 | operation with a FIFO such as | ||
1011 | an underrun or overrun, this | ||
1012 | error requires the device to | ||
1013 | be reset */ | ||
1014 | -#define XST_RESET_ERROR 8L /* an error occurred which requires | ||
1015 | - the device to be reset */ | ||
1016 | -#define XST_DMA_ERROR 9L /* a DMA error occurred, this error | ||
1017 | - typically requires the device | ||
1018 | - using the DMA to be reset */ | ||
1019 | -#define XST_NOT_POLLED 10L /* the device is not configured for | ||
1020 | - polled mode operation */ | ||
1021 | -#define XST_FIFO_NO_ROOM 11L /* a FIFO did not have room to put | ||
1022 | - the specified data into */ | ||
1023 | -#define XST_BUFFER_TOO_SMALL 12L /* the buffer is not large enough | ||
1024 | - to hold the expected data */ | ||
1025 | -#define XST_NO_DATA 13L /* there was no data available */ | ||
1026 | -#define XST_REGISTER_ERROR 14L /* a register did not contain the | ||
1027 | - expected value */ | ||
1028 | -#define XST_INVALID_PARAM 15L /* an invalid parameter was passed | ||
1029 | - into the function */ | ||
1030 | -#define XST_NOT_SGDMA 16L /* the device is not configured for | ||
1031 | - scatter-gather DMA operation */ | ||
1032 | -#define XST_LOOPBACK_ERROR 17L /* a loopback test failed */ | ||
1033 | -#define XST_NO_CALLBACK 18L /* a callback has not yet been | ||
1034 | - * registered */ | ||
1035 | -#define XST_NO_FEATURE 19L /* device is not configured with | ||
1036 | - * the requested feature */ | ||
1037 | -#define XST_NOT_INTERRUPT 20L /* device is not configured for | ||
1038 | - * interrupt mode operation */ | ||
1039 | -#define XST_DEVICE_BUSY 21L /* device is busy */ | ||
1040 | -#define XST_ERROR_COUNT_MAX 22L /* the error counters of a device | ||
1041 | - * have maxed out */ | ||
1042 | -#define XST_IS_STARTED 23L /* used when part of device is | ||
1043 | - * already started i.e. | ||
1044 | - * sub channel */ | ||
1045 | -#define XST_IS_STOPPED 24L /* used when part of device is | ||
1046 | - * already stopped i.e. | ||
1047 | - * sub channel */ | ||
1048 | +#define XST_RESET_ERROR 8L /* an error occurred which | ||
1049 | + requires the device to be | ||
1050 | + reset */ | ||
1051 | +#define XST_DMA_ERROR 9L /* a DMA error occurred, this | ||
1052 | + error typically requires the | ||
1053 | + device using the DMA to be | ||
1054 | + reset */ | ||
1055 | +#define XST_NOT_POLLED 10L /* the device is not configured | ||
1056 | + for polled mode operation */ | ||
1057 | +#define XST_FIFO_NO_ROOM 11L /* a FIFO did not have room to | ||
1058 | + put the specified data into | ||
1059 | + */ | ||
1060 | +#define XST_BUFFER_TOO_SMALL 12L /* the buffer is not large | ||
1061 | + enough to hold the expected | ||
1062 | + data */ | ||
1063 | +#define XST_NO_DATA 13L /* there was no data available | ||
1064 | + */ | ||
1065 | +#define XST_REGISTER_ERROR 14L /* a register did not contain | ||
1066 | + the expected value */ | ||
1067 | +#define XST_INVALID_PARAM 15L /* an invalid parameter was | ||
1068 | + passed into the function */ | ||
1069 | +#define XST_NOT_SGDMA 16L /* the device is not configured | ||
1070 | + for scatter-gather DMA | ||
1071 | + operation */ | ||
1072 | +#define XST_LOOPBACK_ERROR 17L /* a loopback test failed */ | ||
1073 | +#define XST_NO_CALLBACK 18L /* a callback has not yet been | ||
1074 | + registered */ | ||
1075 | +#define XST_NO_FEATURE 19L /* device is not configured with | ||
1076 | + the requested feature */ | ||
1077 | +#define XST_NOT_INTERRUPT 20L /* device is not configured for | ||
1078 | + interrupt mode operation */ | ||
1079 | +#define XST_DEVICE_BUSY 21L /* device is busy */ | ||
1080 | +#define XST_ERROR_COUNT_MAX 22L /* the error counters of a | ||
1081 | + device have maxed out */ | ||
1082 | +#define XST_IS_STARTED 23L /* used when part of device is | ||
1083 | + already started i.e. | ||
1084 | + sub channel */ | ||
1085 | +#define XST_IS_STOPPED 24L /* used when part of device is | ||
1086 | + already stopped i.e. | ||
1087 | + sub channel */ | ||
1088 | +#define XST_DATA_LOST 26L /* driver defined error */ | ||
1089 | +#define XST_RECV_ERROR 27L /* generic receive error */ | ||
1090 | +#define XST_SEND_ERROR 28L /* generic transmit error */ | ||
1091 | +#define XST_NOT_ENABLED 29L /* a requested service is not | ||
1092 | + available because it has not | ||
1093 | + been enabled */ | ||
1094 | |||
1095 | /***************** Utility Component statuses 401 - 500 *********************/ | ||
1096 | |||
1097 | -#define XST_MEMTEST_FAILED 401L /* memory test failed */ | ||
1098 | +#define XST_MEMTEST_FAILED 401L /* memory test failed */ | ||
1099 | |||
1100 | /***************** Common Components statuses 501 - 1000 *********************/ | ||
1101 | |||
1102 | /********************* Packet Fifo statuses 501 - 510 ************************/ | ||
1103 | |||
1104 | -#define XST_PFIFO_LACK_OF_DATA 501L /* not enough data in FIFO */ | ||
1105 | -#define XST_PFIFO_NO_ROOM 502L /* not enough room in FIFO */ | ||
1106 | -#define XST_PFIFO_BAD_REG_VALUE 503L /* self test, a register value | ||
1107 | +#define XST_PFIFO_LACK_OF_DATA 501L /* not enough data in FIFO */ | ||
1108 | +#define XST_PFIFO_NO_ROOM 502L /* not enough room in FIFO */ | ||
1109 | +#define XST_PFIFO_BAD_REG_VALUE 503L /* self test, a register value | ||
1110 | was invalid after reset */ | ||
1111 | +#define XST_PFIFO_ERROR 504L /* generic packet FIFO error */ | ||
1112 | +#define XST_PFIFO_DEADLOCK 505L /* packet FIFO is reporting | ||
1113 | + * empty and full simultaneously | ||
1114 | + */ | ||
1115 | |||
1116 | /************************** DMA statuses 511 - 530 ***************************/ | ||
1117 | |||
1118 | -#define XST_DMA_TRANSFER_ERROR 511L /* self test, DMA transfer | ||
1119 | +#define XST_DMA_TRANSFER_ERROR 511L /* self test, DMA transfer | ||
1120 | failed */ | ||
1121 | -#define XST_DMA_RESET_REGISTER_ERROR 512L /* self test, a register value | ||
1122 | +#define XST_DMA_RESET_REGISTER_ERROR 512L /* self test, a register value | ||
1123 | was invalid after reset */ | ||
1124 | -#define XST_DMA_SG_LIST_EMPTY 513L /* scatter gather list contains | ||
1125 | +#define XST_DMA_SG_LIST_EMPTY 513L /* scatter gather list contains | ||
1126 | no buffer descriptors ready | ||
1127 | to be processed */ | ||
1128 | -#define XST_DMA_SG_IS_STARTED 514L /* scatter gather not stopped */ | ||
1129 | -#define XST_DMA_SG_IS_STOPPED 515L /* scatter gather not running */ | ||
1130 | -#define XST_DMA_SG_LIST_FULL 517L /* all the buffer desciptors of | ||
1131 | +#define XST_DMA_SG_IS_STARTED 514L /* scatter gather not stopped */ | ||
1132 | +#define XST_DMA_SG_IS_STOPPED 515L /* scatter gather not running */ | ||
1133 | +#define XST_DMA_SG_LIST_FULL 517L /* all the buffer desciptors of | ||
1134 | the scatter gather list are | ||
1135 | being used */ | ||
1136 | -#define XST_DMA_SG_BD_LOCKED 518L /* the scatter gather buffer | ||
1137 | +#define XST_DMA_SG_BD_LOCKED 518L /* the scatter gather buffer | ||
1138 | descriptor which is to be | ||
1139 | copied over in the scatter | ||
1140 | list is locked */ | ||
1141 | -#define XST_DMA_SG_NOTHING_TO_COMMIT 519L /* no buffer descriptors have been | ||
1142 | - put into the scatter gather | ||
1143 | - list to be commited */ | ||
1144 | -#define XST_DMA_SG_COUNT_EXCEEDED 521L /* the packet count threshold | ||
1145 | +#define XST_DMA_SG_NOTHING_TO_COMMIT 519L /* no buffer descriptors have | ||
1146 | + been put into the scatter | ||
1147 | + gather list to be commited */ | ||
1148 | +#define XST_DMA_SG_COUNT_EXCEEDED 521L /* the packet count threshold | ||
1149 | specified was larger than the | ||
1150 | total # of buffer descriptors | ||
1151 | in the scatter gather list */ | ||
1152 | -#define XST_DMA_SG_LIST_EXISTS 522L /* the scatter gather list has | ||
1153 | +#define XST_DMA_SG_LIST_EXISTS 522L /* the scatter gather list has | ||
1154 | already been created */ | ||
1155 | -#define XST_DMA_SG_NO_LIST 523L /* no scatter gather list has | ||
1156 | +#define XST_DMA_SG_NO_LIST 523L /* no scatter gather list has | ||
1157 | been created */ | ||
1158 | -#define XST_DMA_SG_BD_NOT_COMMITTED 524L /* the buffer descriptor which was | ||
1159 | - being started was not committed | ||
1160 | - to the list */ | ||
1161 | -#define XST_DMA_SG_NO_DATA 525L /* the buffer descriptor to start | ||
1162 | - has already been used by the | ||
1163 | - hardware so it can't be reused | ||
1164 | - */ | ||
1165 | +#define XST_DMA_SG_BD_NOT_COMMITTED 524L /* the buffer descriptor which | ||
1166 | + was being started was not | ||
1167 | + committed to the list */ | ||
1168 | +#define XST_DMA_SG_NO_DATA 525L /* the buffer descriptor to | ||
1169 | + start has already been used | ||
1170 | + by the hardware so it can't | ||
1171 | + be reused */ | ||
1172 | +#define XST_DMA_SG_LIST_ERROR 526L /* general purpose list access | ||
1173 | + error */ | ||
1174 | +#define XST_DMA_BD_ERROR 527L /* general buffer descriptor | ||
1175 | + error */ | ||
1176 | |||
1177 | /************************** IPIF statuses 531 - 550 ***************************/ | ||
1178 | |||
1179 | -#define XST_IPIF_REG_WIDTH_ERROR 531L /* an invalid register width | ||
1180 | +#define XST_IPIF_REG_WIDTH_ERROR 531L /* an invalid register width | ||
1181 | was passed into the function */ | ||
1182 | -#define XST_IPIF_RESET_REGISTER_ERROR 532L /* the value of a register at | ||
1183 | +#define XST_IPIF_RESET_REGISTER_ERROR 532L /* the value of a register at | ||
1184 | reset was not valid */ | ||
1185 | -#define XST_IPIF_DEVICE_STATUS_ERROR 533L /* a write to the device interrupt | ||
1186 | +#define XST_IPIF_DEVICE_STATUS_ERROR 533L /* a write to the device intr | ||
1187 | status register did not read | ||
1188 | back correctly */ | ||
1189 | -#define XST_IPIF_DEVICE_ACK_ERROR 534L /* the device interrupt status | ||
1190 | +#define XST_IPIF_DEVICE_ACK_ERROR 534L /* the device interrupt status | ||
1191 | register did not reset when | ||
1192 | acked */ | ||
1193 | -#define XST_IPIF_DEVICE_ENABLE_ERROR 535L /* the device interrupt enable | ||
1194 | +#define XST_IPIF_DEVICE_ENABLE_ERROR 535L /* the device interrupt enable | ||
1195 | register was not updated when | ||
1196 | other registers changed */ | ||
1197 | -#define XST_IPIF_IP_STATUS_ERROR 536L /* a write to the IP interrupt | ||
1198 | +#define XST_IPIF_IP_STATUS_ERROR 536L /* a write to the IP interrupt | ||
1199 | status register did not read | ||
1200 | back correctly */ | ||
1201 | -#define XST_IPIF_IP_ACK_ERROR 537L /* the IP interrupt status register | ||
1202 | - did not reset when acked */ | ||
1203 | -#define XST_IPIF_IP_ENABLE_ERROR 538L /* IP interrupt enable register was | ||
1204 | - not updated correctly when other | ||
1205 | - registers changed */ | ||
1206 | -#define XST_IPIF_DEVICE_PENDING_ERROR 539L /* The device interrupt pending | ||
1207 | +#define XST_IPIF_IP_ACK_ERROR 537L /* the IP interrupt status | ||
1208 | + register did not reset when | ||
1209 | + acked */ | ||
1210 | +#define XST_IPIF_IP_ENABLE_ERROR 538L /* IP interrupt enable register | ||
1211 | + was not updated correctly | ||
1212 | + when other registers changed | ||
1213 | + */ | ||
1214 | +#define XST_IPIF_DEVICE_PENDING_ERROR 539L /* The device interrupt pending | ||
1215 | + register did not indicate the | ||
1216 | + expected value */ | ||
1217 | +#define XST_IPIF_DEVICE_ID_ERROR 540L /* The device interrupt ID | ||
1218 | register did not indicate the | ||
1219 | expected value */ | ||
1220 | -#define XST_IPIF_DEVICE_ID_ERROR 540L /* The device interrupt ID register | ||
1221 | - did not indicate the expected | ||
1222 | - value */ | ||
1223 | +#define XST_IPIF_ERROR 541L /* generic ipif error */ | ||
1224 | |||
1225 | /****************** Device specific statuses 1001 - 4095 *********************/ | ||
1226 | |||
1227 | /********************* Ethernet statuses 1001 - 1050 *************************/ | ||
1228 | |||
1229 | -#define XST_EMAC_MEMORY_SIZE_ERROR 1001L /* Memory space is not big enough | ||
1230 | - * to hold the minimum number of | ||
1231 | - * buffers or descriptors */ | ||
1232 | -#define XST_EMAC_MEMORY_ALLOC_ERROR 1002L /* Memory allocation failed */ | ||
1233 | -#define XST_EMAC_MII_READ_ERROR 1003L /* MII read error */ | ||
1234 | -#define XST_EMAC_MII_BUSY 1004L /* An MII operation is in progress */ | ||
1235 | -#define XST_EMAC_OUT_OF_BUFFERS 1005L /* Adapter is out of buffers */ | ||
1236 | -#define XST_EMAC_PARSE_ERROR 1006L /* Invalid adapter init string */ | ||
1237 | -#define XST_EMAC_COLLISION_ERROR 1007L /* Excess deferral or late | ||
1238 | +#define XST_EMAC_MEMORY_SIZE_ERROR 1001L /* Memory space is not big | ||
1239 | + * enough to hold the minimum | ||
1240 | + * number of buffers or | ||
1241 | + * descriptors */ | ||
1242 | +#define XST_EMAC_MEMORY_ALLOC_ERROR 1002L /* Memory allocation failed */ | ||
1243 | +#define XST_EMAC_MII_READ_ERROR 1003L /* MII read error */ | ||
1244 | +#define XST_EMAC_MII_BUSY 1004L /* An MII operation is in | ||
1245 | + * progress */ | ||
1246 | +#define XST_EMAC_OUT_OF_BUFFERS 1005L /* Driver is out of buffers */ | ||
1247 | +#define XST_EMAC_PARSE_ERROR 1006L /* Invalid driver init string */ | ||
1248 | +#define XST_EMAC_COLLISION_ERROR 1007L /* Excess deferral or late | ||
1249 | * collision on polled send */ | ||
1250 | |||
1251 | /*********************** UART statuses 1051 - 1075 ***************************/ | ||
1252 | #define XST_UART | ||
1253 | |||
1254 | -#define XST_UART_INIT_ERROR 1051L | ||
1255 | -#define XST_UART_START_ERROR 1052L | ||
1256 | -#define XST_UART_CONFIG_ERROR 1053L | ||
1257 | -#define XST_UART_TEST_FAIL 1054L | ||
1258 | -#define XST_UART_BAUD_ERROR 1055L | ||
1259 | -#define XST_UART_BAUD_RANGE 1056L | ||
1260 | +#define XST_UART_INIT_ERROR 1051L | ||
1261 | +#define XST_UART_START_ERROR 1052L | ||
1262 | +#define XST_UART_CONFIG_ERROR 1053L | ||
1263 | +#define XST_UART_TEST_FAIL 1054L | ||
1264 | +#define XST_UART_BAUD_ERROR 1055L | ||
1265 | +#define XST_UART_BAUD_RANGE 1056L | ||
1266 | |||
1267 | /************************ IIC statuses 1076 - 1100 ***************************/ | ||
1268 | |||
1269 | -#define XST_IIC_SELFTEST_FAILED 1076 /* self test failed */ | ||
1270 | -#define XST_IIC_BUS_BUSY 1077 /* bus found busy */ | ||
1271 | -#define XST_IIC_GENERAL_CALL_ADDRESS 1078 /* mastersend attempted with */ | ||
1272 | - /* general call address */ | ||
1273 | -#define XST_IIC_STAND_REG_RESET_ERROR 1079 /* A non parameterizable reg */ | ||
1274 | - /* value after reset not valid */ | ||
1275 | -#define XST_IIC_TX_FIFO_REG_RESET_ERROR 1080 /* Tx fifo included in design */ | ||
1276 | - /* value after reset not valid */ | ||
1277 | -#define XST_IIC_RX_FIFO_REG_RESET_ERROR 1081 /* Rx fifo included in design */ | ||
1278 | - /* value after reset not valid */ | ||
1279 | -#define XST_IIC_TBA_REG_RESET_ERROR 1082 /* 10 bit addr incl in design */ | ||
1280 | - /* value after reset not valid */ | ||
1281 | -#define XST_IIC_CR_READBACK_ERROR 1083 /* Read of the control register */ | ||
1282 | - /* didn't return value written */ | ||
1283 | -#define XST_IIC_DTR_READBACK_ERROR 1084 /* Read of the data Tx reg */ | ||
1284 | - /* didn't return value written */ | ||
1285 | -#define XST_IIC_DRR_READBACK_ERROR 1085 /* Read of the data Receive reg */ | ||
1286 | - /* didn't return value written */ | ||
1287 | -#define XST_IIC_ADR_READBACK_ERROR 1086 /* Read of the data Tx reg */ | ||
1288 | - /* didn't return value written */ | ||
1289 | -#define XST_IIC_TBA_READBACK_ERROR 1087 /* Read of the 10 bit addr reg */ | ||
1290 | - /* didn't return written value */ | ||
1291 | -#define XST_IIC_NOT_SLAVE 1088 /* The device isn't a slave */ | ||
1292 | +#define XST_IIC_SELFTEST_FAILED 1076 /* self test failed */ | ||
1293 | +#define XST_IIC_BUS_BUSY 1077 /* bus found busy */ | ||
1294 | +#define XST_IIC_GENERAL_CALL_ADDRESS 1078 /* mastersend attempted with | ||
1295 | + * general call address */ | ||
1296 | +#define XST_IIC_STAND_REG_RESET_ERROR 1079 /* A non parameterizable reg | ||
1297 | + * value after reset not valid | ||
1298 | + */ | ||
1299 | +#define XST_IIC_TX_FIFO_REG_RESET_ERROR 1080 /* Tx fifo included in design | ||
1300 | + * value after reset not valid | ||
1301 | + */ | ||
1302 | +#define XST_IIC_RX_FIFO_REG_RESET_ERROR 1081 /* Rx fifo included in design | ||
1303 | + * value after reset not valid | ||
1304 | + */ | ||
1305 | +#define XST_IIC_TBA_REG_RESET_ERROR 1082 /* 10 bit addr incl in design | ||
1306 | + * value after reset not valid | ||
1307 | + */ | ||
1308 | +#define XST_IIC_CR_READBACK_ERROR 1083 /* Read of the control register | ||
1309 | + * didn't return value written | ||
1310 | + */ | ||
1311 | +#define XST_IIC_DTR_READBACK_ERROR 1084 /* Read of the data Tx reg | ||
1312 | + * didn't return value written | ||
1313 | + */ | ||
1314 | +#define XST_IIC_DRR_READBACK_ERROR 1085 /* Read of the data Receive reg | ||
1315 | + * didn't return value written | ||
1316 | + */ | ||
1317 | +#define XST_IIC_ADR_READBACK_ERROR 1086 /* Read of the data Tx reg | ||
1318 | + * didn't return value written | ||
1319 | + */ | ||
1320 | +#define XST_IIC_TBA_READBACK_ERROR 1087 /* Read of the 10 bit addr reg | ||
1321 | + * didn't return written value | ||
1322 | + */ | ||
1323 | +#define XST_IIC_NOT_SLAVE 1088 /* The device isn't a slave */ | ||
1324 | |||
1325 | /*********************** ATMC statuses 1101 - 1125 ***************************/ | ||
1326 | |||
1327 | -#define XST_ATMC_ERROR_COUNT_MAX 1101L /* the error counters in the ATM | ||
1328 | +#define XST_ATMC_ERROR_COUNT_MAX 1101L /* the error counters in the ATM | ||
1329 | controller hit the max value | ||
1330 | which requires the statistics | ||
1331 | to be cleared */ | ||
1332 | |||
1333 | /*********************** Flash statuses 1126 - 1150 **************************/ | ||
1334 | |||
1335 | -#define XST_FLASH_BUSY 1126L /* Flash is erasing or programming */ | ||
1336 | -#define XST_FLASH_READY 1127L /* Flash is ready for commands */ | ||
1337 | -#define XST_FLASH_ERROR 1128L /* Flash had detected an internal | ||
1338 | - error. Use XFlash_DeviceControl | ||
1339 | +#define XST_FLASH_BUSY 1126L /* Flash is erasing or | ||
1340 | + programming */ | ||
1341 | +#define XST_FLASH_READY 1127L /* Flash is ready for commands | ||
1342 | + */ | ||
1343 | +#define XST_FLASH_ERROR 1128L /* Flash had detected an | ||
1344 | + internal error. Use | ||
1345 | + XFlash_DeviceControl | ||
1346 | to retrieve device specific codes */ | ||
1347 | -#define XST_FLASH_ERASE_SUSPENDED 1129L /* Flash is in suspended erase state */ | ||
1348 | -#define XST_FLASH_WRITE_SUSPENDED 1130L /* Flash is in suspended write state */ | ||
1349 | -#define XST_FLASH_PART_NOT_SUPPORTED 1131L /* Flash type not supported by | ||
1350 | +#define XST_FLASH_ERASE_SUSPENDED 1129L /* Flash is in suspended erase | ||
1351 | + state */ | ||
1352 | +#define XST_FLASH_WRITE_SUSPENDED 1130L /* Flash is in suspended write | ||
1353 | + state */ | ||
1354 | +#define XST_FLASH_PART_NOT_SUPPORTED 1131L /* Flash type not supported by | ||
1355 | driver */ | ||
1356 | -#define XST_FLASH_NOT_SUPPORTED 1132L /* Operation not supported */ | ||
1357 | -#define XST_FLASH_TOO_MANY_REGIONS 1133L /* Too many erase regions */ | ||
1358 | -#define XST_FLASH_TIMEOUT_ERROR 1134L /* Programming or erase operation | ||
1359 | - aborted due to a timeout */ | ||
1360 | -#define XST_FLASH_ADDRESS_ERROR 1135L /* Accessed flash outside its | ||
1361 | +#define XST_FLASH_NOT_SUPPORTED 1132L /* Operation not supported */ | ||
1362 | +#define XST_FLASH_TOO_MANY_REGIONS 1133L /* Too many erase regions */ | ||
1363 | +#define XST_FLASH_TIMEOUT_ERROR 1134L /* Programming or erase | ||
1364 | + operation aborted due to a | ||
1365 | + timeout */ | ||
1366 | +#define XST_FLASH_ADDRESS_ERROR 1135L /* Accessed flash outside its | ||
1367 | addressible range */ | ||
1368 | -#define XST_FLASH_ALIGNMENT_ERROR 1136L /* Write alignment error */ | ||
1369 | -#define XST_FLASH_BLOCKING_CALL_ERROR 1137L /* Couldn't return immediately from | ||
1370 | - write/erase function with | ||
1371 | - XFL_NON_BLOCKING_WRITE/ERASE | ||
1372 | - option cleared */ | ||
1373 | -#define XST_FLASH_CFI_QUERY_ERROR 1138L /* Failed to query the device */ | ||
1374 | +#define XST_FLASH_ALIGNMENT_ERROR 1136L /* Write alignment error */ | ||
1375 | +#define XST_FLASH_BLOCKING_CALL_ERROR 1137L /* Couldn't return immediately | ||
1376 | + from write/erase function | ||
1377 | + with XFL_NON_BLOCKING_WRITE/ | ||
1378 | + ERASE option cleared */ | ||
1379 | +#define XST_FLASH_CFI_QUERY_ERROR 1138L /* Failed to query the device */ | ||
1380 | |||
1381 | /*********************** SPI statuses 1151 - 1175 ****************************/ | ||
1382 | |||
1383 | -#define XST_SPI_MODE_FAULT 1151 /* master was selected as slave */ | ||
1384 | -#define XST_SPI_TRANSFER_DONE 1152 /* data transfer is complete */ | ||
1385 | -#define XST_SPI_TRANSMIT_UNDERRUN 1153 /* slave underruns transmit register */ | ||
1386 | -#define XST_SPI_RECEIVE_OVERRUN 1154 /* device overruns receive register */ | ||
1387 | -#define XST_SPI_NO_SLAVE 1155 /* no slave has been selected yet */ | ||
1388 | -#define XST_SPI_TOO_MANY_SLAVES 1156 /* more than one slave is being | ||
1389 | +#define XST_SPI_MODE_FAULT 1151 /* master was selected as slave | ||
1390 | + */ | ||
1391 | +#define XST_SPI_TRANSFER_DONE 1152 /* data transfer is complete */ | ||
1392 | +#define XST_SPI_TRANSMIT_UNDERRUN 1153 /* slave underruns transmit | ||
1393 | + * register */ | ||
1394 | +#define XST_SPI_RECEIVE_OVERRUN 1154 /* device overruns receive | ||
1395 | + * register */ | ||
1396 | +#define XST_SPI_NO_SLAVE 1155 /* no slave has been selected | ||
1397 | + * yet */ | ||
1398 | +#define XST_SPI_TOO_MANY_SLAVES 1156 /* more than one slave is being | ||
1399 | * selected */ | ||
1400 | -#define XST_SPI_NOT_MASTER 1157 /* operation is valid only as master */ | ||
1401 | -#define XST_SPI_SLAVE_ONLY 1158 /* device is configured as slave-only */ | ||
1402 | -#define XST_SPI_SLAVE_MODE_FAULT 1159 /* slave was selected while disabled */ | ||
1403 | +#define XST_SPI_NOT_MASTER 1157 /* operation is valid only as | ||
1404 | + * master */ | ||
1405 | +#define XST_SPI_SLAVE_ONLY 1158 /* device is configured as | ||
1406 | + * slave-only */ | ||
1407 | +#define XST_SPI_SLAVE_MODE_FAULT 1159 /* slave was selected while | ||
1408 | + * disabled */ | ||
1409 | |||
1410 | /********************** OPB Arbiter statuses 1176 - 1200 *********************/ | ||
1411 | |||
1412 | -#define XST_OPBARB_INVALID_PRIORITY 1176 /* the priority registers have either | ||
1413 | - * one master assigned to two or more | ||
1414 | - * priorities, or one master not | ||
1415 | - * assigned to any priority | ||
1416 | +#define XST_OPBARB_INVALID_PRIORITY 1176 /* the priority registers have | ||
1417 | + either one master assigned to | ||
1418 | + * two or more priorities, or | ||
1419 | + * one master not assigned | ||
1420 | + * to any priority | ||
1421 | */ | ||
1422 | -#define XST_OPBARB_NOT_SUSPENDED 1177 /* an attempt was made to modify the | ||
1423 | - * priority levels without first | ||
1424 | - * suspending the use of priority | ||
1425 | - * levels | ||
1426 | +#define XST_OPBARB_NOT_SUSPENDED 1177 /* an attempt was made to modify | ||
1427 | + * the priority levels without | ||
1428 | + * first suspending the use of | ||
1429 | + * priority levels | ||
1430 | */ | ||
1431 | -#define XST_OPBARB_PARK_NOT_ENABLED 1178 /* bus parking by id was enabled but | ||
1432 | - * bus parking was not enabled | ||
1433 | - */ | ||
1434 | -#define XST_OPBARB_NOT_FIXED_PRIORITY 1179 /* the arbiter must be in fixed | ||
1435 | +#define XST_OPBARB_PARK_NOT_ENABLED 1178 /* bus parking by id was enabled | ||
1436 | + * but bus parking was not | ||
1437 | + * enabled */ | ||
1438 | +#define XST_OPBARB_NOT_FIXED_PRIORITY 1179 /* the arbiter must be in fixed | ||
1439 | * priority mode to allow the | ||
1440 | * priorities to be changed | ||
1441 | */ | ||
1442 | |||
1443 | /************************ Intc statuses 1201 - 1225 **************************/ | ||
1444 | |||
1445 | -#define XST_INTC_FAIL_SELFTEST 1201 /* self test failed */ | ||
1446 | -#define XST_INTC_CONNECT_ERROR 1202 /* interrupt already in use */ | ||
1447 | +#define XST_INTC_FAIL_SELFTEST 1201 /* self test failed */ | ||
1448 | +#define XST_INTC_CONNECT_ERROR 1202 /* interrupt already in use */ | ||
1449 | |||
1450 | /********************** TmrCtr statuses 1226 - 1250 **************************/ | ||
1451 | |||
1452 | -#define XST_TMRCTR_TIMER_FAILED 1226 /* self test failed */ | ||
1453 | +#define XST_TMRCTR_TIMER_FAILED 1226 /* self test failed */ | ||
1454 | |||
1455 | /********************** WdtTb statuses 1251 - 1275 ***************************/ | ||
1456 | |||
1457 | -#define XST_WDTTB_TIMER_FAILED 1251L | ||
1458 | +#define XST_WDTTB_TIMER_FAILED 1251L | ||
1459 | |||
1460 | /********************** PlbArb statuses 1276 - 1300 **************************/ | ||
1461 | |||
1462 | -#define XST_PLBARB_FAIL_SELFTEST 1276L | ||
1463 | +#define XST_PLBARB_FAIL_SELFTEST 1276L | ||
1464 | |||
1465 | /********************** Plb2Opb statuses 1301 - 1325 *************************/ | ||
1466 | |||
1467 | -#define XST_PLB2OPB_FAIL_SELFTEST 1301L | ||
1468 | +#define XST_PLB2OPB_FAIL_SELFTEST 1301L | ||
1469 | |||
1470 | /********************** Opb2Plb statuses 1326 - 1350 *************************/ | ||
1471 | |||
1472 | -#define XST_OPB2PLB_FAIL_SELFTEST 1326L | ||
1473 | +#define XST_OPB2PLB_FAIL_SELFTEST 1326L | ||
1474 | |||
1475 | /********************** SysAce statuses 1351 - 1360 **************************/ | ||
1476 | |||
1477 | -#define XST_SYSACE_NO_LOCK 1351L /* No MPU lock has been granted */ | ||
1478 | +#define XST_SYSACE_NO_LOCK 1351L /* No MPU lock has been granted | ||
1479 | + */ | ||
1480 | |||
1481 | /********************** PCI Bridge statuses 1361 - 1375 **********************/ | ||
1482 | |||
1483 | -#define XST_PCI_INVALID_ADDRESS 1361L | ||
1484 | +#define XST_PCI_INVALID_ADDRESS 1361L | ||
1485 | + | ||
1486 | +/********************** FlexRay constants 1400 - 1409 *************************/ | ||
1487 | + | ||
1488 | +#define XST_FR_TX_ERROR 1400 | ||
1489 | +#define XST_FR_TX_BUSY 1401 | ||
1490 | +#define XST_FR_BUF_LOCKED 1402 | ||
1491 | +#define XST_FR_NO_BUF 1403 | ||
1492 | + | ||
1493 | +/****************** USB constants 1410 - 1420 *******************************/ | ||
1494 | + | ||
1495 | +#define XST_USB_ALREADY_CONFIGURED 1410 | ||
1496 | +#define XST_USB_BUF_ALIGN_ERROR 1411 | ||
1497 | +#define XST_USB_NO_DESC_AVAILABLE 1412 | ||
1498 | +#define XST_USB_BUF_TOO_BIG 1413 | ||
1499 | +#define XST_USB_NO_BUF 1414 | ||
1500 | + | ||
1501 | +/****************** HWICAP constants 1421 - 1430 *****************************/ | ||
1502 | + | ||
1503 | +#define XST_HWICAP_WRITE_DONE 1421 | ||
1504 | |||
1505 | /**************************** Type Definitions *******************************/ | ||
1506 | |||
1507 | -/** | ||
1508 | - * The status typedef. | ||
1509 | - */ | ||
1510 | -typedef u32 XStatus; | ||
1511 | +typedef int XStatus; | ||
1512 | |||
1513 | /***************** Macros (Inline Functions) Definitions *********************/ | ||
1514 | |||
1515 | /************************** Function Prototypes ******************************/ | ||
1516 | |||
1517 | -#endif /* end of protection macro */ | ||
1518 | +#ifdef __cplusplus | ||
1519 | +} | ||
1520 | +#endif | ||
1521 | + | ||
1522 | +#endif /* end of protection macro */ | ||
1523 | diff --git a/board/xilinx/microblaze-generic/.gitignore b/board/xilinx/microblaze-generic/.gitignore | ||
1524 | new file mode 100644 | ||
1525 | index 0000000..739c63e | ||
1526 | --- /dev/null | ||
1527 | +++ b/board/xilinx/microblaze-generic/.gitignore | ||
1528 | @@ -0,0 +1,5 @@ | ||
1529 | +config.mk | ||
1530 | +dts | ||
1531 | +Makefile | ||
1532 | +microblaze-generic.c | ||
1533 | +xparameters.h | ||
1534 | diff --git a/board/xilinx/microblaze-generic/Makefile b/board/xilinx/microblaze-generic/Makefile | ||
1535 | index 761203d..d4d1169 100644 | ||
1536 | --- a/board/xilinx/microblaze-generic/Makefile | ||
1537 | +++ b/board/xilinx/microblaze-generic/Makefile | ||
1538 | @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk | ||
1539 | |||
1540 | LIB = $(obj)lib$(BOARD).o | ||
1541 | |||
1542 | -COBJS = $(BOARD).o | ||
1543 | +COBJS = microblaze-generic.o | ||
1544 | |||
1545 | SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | ||
1546 | OBJS := $(addprefix $(obj),$(COBJS)) | ||
1547 | diff --git a/board/xilinx/microblaze-generic/config.mk b/board/xilinx/microblaze-generic/config.mk | ||
1548 | deleted file mode 100644 | ||
1549 | index 9fd1015..0000000 | ||
1550 | --- a/board/xilinx/microblaze-generic/config.mk | ||
1551 | +++ /dev/null | ||
1552 | @@ -1,34 +0,0 @@ | ||
1553 | -# | ||
1554 | -# (C) Copyright 2007 Michal Simek | ||
1555 | -# | ||
1556 | -# Michal SIMEK <monstr@monstr.eu> | ||
1557 | -# | ||
1558 | -# See file CREDITS for list of people who contributed to this | ||
1559 | -# project. | ||
1560 | -# | ||
1561 | -# This program is free software; you can redistribute it and/or | ||
1562 | -# modify it under the terms of the GNU General Public License as | ||
1563 | -# published by the Free Software Foundation; either version 2 of | ||
1564 | -# the License, or (at your option) any later version. | ||
1565 | -# | ||
1566 | -# This program is distributed in the hope that it will be useful, | ||
1567 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1568 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1569 | -# GNU General Public License for more details. | ||
1570 | -# | ||
1571 | -# You should have received a copy of the GNU General Public License | ||
1572 | -# along with this program; if not, write to the Free Software | ||
1573 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1574 | -# MA 02111-1307 USA | ||
1575 | -# | ||
1576 | -# CAUTION: This file is a faked configuration !!! | ||
1577 | -# There is no real target for the microblaze-generic | ||
1578 | -# configuration. You have to replace this file with | ||
1579 | -# the generated file from your Xilinx design flow. | ||
1580 | -# | ||
1581 | - | ||
1582 | -CONFIG_SYS_TEXT_BASE = 0x29000000 | ||
1583 | - | ||
1584 | -PLATFORM_CPPFLAGS += -mno-xl-soft-mul | ||
1585 | -PLATFORM_CPPFLAGS += -mno-xl-soft-div | ||
1586 | -PLATFORM_CPPFLAGS += -mxl-barrel-shift | ||
1587 | diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c | ||
1588 | index b75e62c..81b2881 100644 | ||
1589 | --- a/board/xilinx/microblaze-generic/microblaze-generic.c | ||
1590 | +++ b/board/xilinx/microblaze-generic/microblaze-generic.c | ||
1591 | @@ -35,13 +35,18 @@ | ||
1592 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
1593 | { | ||
1594 | #ifdef CONFIG_SYS_GPIO_0 | ||
1595 | - *((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = | ||
1596 | - ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR))); | ||
1597 | + *((u32 volatile *)(CONFIG_SYS_GPIO_0_ADDR)) = | ||
1598 | + ++(*((u32 volatile *)(CONFIG_SYS_GPIO_0_ADDR))); | ||
1599 | #endif | ||
1600 | -#ifdef CONFIG_SYS_RESET_ADDRESS | ||
1601 | - puts ("Reseting board\n"); | ||
1602 | - asm ("bra r0"); | ||
1603 | + | ||
1604 | +#ifdef CONFIG_XILINX_TB_WATCHDOG | ||
1605 | + hw_watchdog_disable(); | ||
1606 | #endif | ||
1607 | + | ||
1608 | + puts ("Reseting board\n"); | ||
1609 | + __asm__ __volatile__ (" mts rmsr, r0;" \ | ||
1610 | + "bra r0"); | ||
1611 | + | ||
1612 | return 0; | ||
1613 | } | ||
1614 | |||
1615 | @@ -53,29 +58,9 @@ int gpio_init (void) | ||
1616 | return 0; | ||
1617 | } | ||
1618 | |||
1619 | -#ifdef CONFIG_SYS_FSL_2 | ||
1620 | -void fsl_isr2 (void *arg) { | ||
1621 | - volatile int num; | ||
1622 | - *((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4)) = | ||
1623 | - ++(*((unsigned int *)(CONFIG_SYS_GPIO_0_ADDR + 0x4))); | ||
1624 | - GET (num, 2); | ||
1625 | - NGET (num, 2); | ||
1626 | - puts("*"); | ||
1627 | -} | ||
1628 | - | ||
1629 | -int fsl_init2 (void) { | ||
1630 | - puts("fsl_init2\n"); | ||
1631 | - install_interrupt_handler (FSL_INTR_2, fsl_isr2, NULL); | ||
1632 | - return 0; | ||
1633 | -} | ||
1634 | -#endif | ||
1635 | - | ||
1636 | void board_init(void) | ||
1637 | { | ||
1638 | gpio_init(); | ||
1639 | -#ifdef CONFIG_SYS_FSL_2 | ||
1640 | - fsl_init2(); | ||
1641 | -#endif | ||
1642 | } | ||
1643 | |||
1644 | int board_eth_init(bd_t *bis) | ||
1645 | @@ -99,41 +84,19 @@ int board_eth_init(bd_t *bis) | ||
1646 | ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR, | ||
1647 | txpp, rxpp); | ||
1648 | #endif | ||
1649 | - | ||
1650 | #ifdef CONFIG_XILINX_LL_TEMAC | ||
1651 | -# ifdef XILINX_LLTEMAC_BASEADDR | ||
1652 | -# ifdef XILINX_LLTEMAC_FIFO_BASEADDR | ||
1653 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR, | ||
1654 | - XILINX_LL_TEMAC_M_FIFO, XILINX_LLTEMAC_FIFO_BASEADDR); | ||
1655 | -# elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR | ||
1656 | -# if XILINX_LLTEMAC_SDMA_USE_DCR == 1 | ||
1657 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR, | ||
1658 | - XILINX_LL_TEMAC_M_SDMA_DCR, | ||
1659 | - XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
1660 | -# else | ||
1661 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR, | ||
1662 | - XILINX_LL_TEMAC_M_SDMA_PLB, | ||
1663 | - XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
1664 | -# endif | ||
1665 | -# endif | ||
1666 | -# endif | ||
1667 | -# ifdef XILINX_LLTEMAC_BASEADDR1 | ||
1668 | -# ifdef XILINX_LLTEMAC_FIFO_BASEADDR1 | ||
1669 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1, | ||
1670 | - XILINX_LL_TEMAC_M_FIFO, XILINX_LLTEMAC_FIFO_BASEADDR1); | ||
1671 | -# elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1 | ||
1672 | -# if XILINX_LLTEMAC_SDMA_USE_DCR == 1 | ||
1673 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1, | ||
1674 | - XILINX_LL_TEMAC_M_SDMA_DCR, | ||
1675 | - XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1); | ||
1676 | -# else | ||
1677 | - ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1, | ||
1678 | - XILINX_LL_TEMAC_M_SDMA_PLB, | ||
1679 | - XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1); | ||
1680 | -# endif | ||
1681 | +# ifdef XILINX_LLTEMAC_FIFO_BASEADDR | ||
1682 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 0, | ||
1683 | + XILINX_LLTEMAC_FIFO_BASEADDR); | ||
1684 | +# elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR | ||
1685 | +# if XILINX_LLTEMAC_SDMA_USE_DCR == 1 | ||
1686 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 3, | ||
1687 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
1688 | +# else | ||
1689 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 1, | ||
1690 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
1691 | # endif | ||
1692 | # endif | ||
1693 | #endif | ||
1694 | - | ||
1695 | return ret; | ||
1696 | } | ||
1697 | diff --git a/board/xilinx/microblaze-generic/xparameters.h b/board/xilinx/microblaze-generic/xparameters.h | ||
1698 | deleted file mode 100644 | ||
1699 | index 50a82d9..0000000 | ||
1700 | --- a/board/xilinx/microblaze-generic/xparameters.h | ||
1701 | +++ /dev/null | ||
1702 | @@ -1,79 +0,0 @@ | ||
1703 | -/* | ||
1704 | - * (C) Copyright 2007 Michal Simek | ||
1705 | - * | ||
1706 | - * Michal SIMEK <monstr@monstr.eu> | ||
1707 | - * | ||
1708 | - * See file CREDITS for list of people who contributed to this | ||
1709 | - * project. | ||
1710 | - * | ||
1711 | - * This program is free software; you can redistribute it and/or | ||
1712 | - * modify it under the terms of the GNU General Public License as | ||
1713 | - * published by the Free Software Foundation; either version 2 of | ||
1714 | - * the License, or (at your option) any later version. | ||
1715 | - * | ||
1716 | - * This program is distributed in the hope that it will be useful, | ||
1717 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1718 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1719 | - * GNU General Public License for more details. | ||
1720 | - * | ||
1721 | - * You should have received a copy of the GNU General Public License | ||
1722 | - * along with this program; if not, write to the Free Software | ||
1723 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1724 | - * MA 02111-1307 USA | ||
1725 | - * | ||
1726 | - * CAUTION: This file is a faked configuration !!! | ||
1727 | - * There is no real target for the microblaze-generic | ||
1728 | - * configuration. You have to replace this file with | ||
1729 | - * the generated file from your Xilinx design flow. | ||
1730 | - */ | ||
1731 | - | ||
1732 | -#define XILINX_BOARD_NAME microblaze-generic | ||
1733 | - | ||
1734 | -/* System Clock Frequency */ | ||
1735 | -#define XILINX_CLOCK_FREQ 100000000 | ||
1736 | - | ||
1737 | -/* Microblaze is microblaze_0 */ | ||
1738 | -#define XILINX_USE_MSR_INSTR 1 | ||
1739 | -#define XILINX_FSL_NUMBER 3 | ||
1740 | - | ||
1741 | -/* Interrupt controller is opb_intc_0 */ | ||
1742 | -#define XILINX_INTC_BASEADDR 0x41200000 | ||
1743 | -#define XILINX_INTC_NUM_INTR_INPUTS 6 | ||
1744 | - | ||
1745 | -/* Timer pheriphery is opb_timer_1 */ | ||
1746 | -#define XILINX_TIMER_BASEADDR 0x41c00000 | ||
1747 | -#define XILINX_TIMER_IRQ 0 | ||
1748 | - | ||
1749 | -/* Uart pheriphery is RS232_Uart */ | ||
1750 | -#define XILINX_UARTLITE_BASEADDR 0x40600000 | ||
1751 | -#define XILINX_UARTLITE_BAUDRATE 115200 | ||
1752 | - | ||
1753 | -/* IIC pheriphery is IIC_EEPROM */ | ||
1754 | -#define XILINX_IIC_0_BASEADDR 0x40800000 | ||
1755 | -#define XILINX_IIC_0_FREQ 100000 | ||
1756 | -#define XILINX_IIC_0_BIT 0 | ||
1757 | - | ||
1758 | -/* GPIO is LEDs_4Bit*/ | ||
1759 | -#define XILINX_GPIO_BASEADDR 0x40000000 | ||
1760 | - | ||
1761 | -/* Flash Memory is FLASH_2Mx32 */ | ||
1762 | -#define XILINX_FLASH_START 0x2c000000 | ||
1763 | -#define XILINX_FLASH_SIZE 0x00800000 | ||
1764 | - | ||
1765 | -/* Main Memory is DDR_SDRAM_64Mx32 */ | ||
1766 | -#define XILINX_RAM_START 0x28000000 | ||
1767 | -#define XILINX_RAM_SIZE 0x04000000 | ||
1768 | - | ||
1769 | -/* Sysace Controller is SysACE_CompactFlash */ | ||
1770 | -#define XILINX_SYSACE_BASEADDR 0x41800000 | ||
1771 | -#define XILINX_SYSACE_HIGHADDR 0x4180ffff | ||
1772 | -#define XILINX_SYSACE_MEM_WIDTH 16 | ||
1773 | - | ||
1774 | -/* Ethernet controller is Ethernet_MAC */ | ||
1775 | -#define XILINX_EMACLITE_BASEADDR 0x40C00000 | ||
1776 | - | ||
1777 | -/* LL_TEMAC Ethernet controller */ | ||
1778 | -#define XILINX_LLTEMAC_BASEADDR 0x44000000 | ||
1779 | -#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR 0x42000180 | ||
1780 | -#define XILINX_LLTEMAC_BASEADDR1 0x44200000 | ||
1781 | -#define XILINX_LLTEMAC_FIFO_BASEADDR1 0x42100000 | ||
1782 | diff --git a/board/xilinx/ml507/.gitignore b/board/xilinx/ml507/.gitignore | ||
1783 | deleted file mode 100644 | ||
1784 | index f6418a0..0000000 | ||
1785 | --- a/board/xilinx/ml507/.gitignore | ||
1786 | +++ /dev/null | ||
1787 | @@ -1 +0,0 @@ | ||
1788 | -/config.tmp | ||
1789 | diff --git a/board/xilinx/ml507/Makefile b/board/xilinx/ml507/Makefile | ||
1790 | deleted file mode 100644 | ||
1791 | index de23f29..0000000 | ||
1792 | --- a/board/xilinx/ml507/Makefile | ||
1793 | +++ /dev/null | ||
1794 | @@ -1,27 +0,0 @@ | ||
1795 | -# | ||
1796 | -# (C) Copyright 2008 | ||
1797 | -# Ricardo Ribalda,Universidad Autonoma de Madrid, ricardo.ribalda@uam.es | ||
1798 | -# This work has been supported by: Qtechnology http://qtec.com/ | ||
1799 | -# | ||
1800 | -# See file CREDITS for list of people who contributed to this | ||
1801 | -# project. | ||
1802 | -# | ||
1803 | -# This program is free software; you can redistribute it and/or | ||
1804 | -# modify it under the terms of the GNU General Public License as | ||
1805 | -# published by the Free Software Foundation; either version 2 of | ||
1806 | -# the License, or (at your option) any later version. | ||
1807 | -# | ||
1808 | -# This program is distributed in the hope that it will be useful, | ||
1809 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1810 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1811 | -# GNU General Public License for more details. | ||
1812 | -# | ||
1813 | -# You should have received a copy of the GNU General Public License | ||
1814 | -# along with this program; if not, write to the Free Software | ||
1815 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1816 | -# MA 02111-1307 USA | ||
1817 | -# | ||
1818 | - | ||
1819 | -COBJS += $(BOARD).o | ||
1820 | - | ||
1821 | -include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile | ||
1822 | diff --git a/board/xilinx/ml507/ml507.c b/board/xilinx/ml507/ml507.c | ||
1823 | deleted file mode 100644 | ||
1824 | index f9789cf..0000000 | ||
1825 | --- a/board/xilinx/ml507/ml507.c | ||
1826 | +++ /dev/null | ||
1827 | @@ -1,28 +0,0 @@ | ||
1828 | -/* | ||
1829 | - * (C) Copyright 2008 | ||
1830 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1831 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
1832 | - * This program is free software: you can redistribute it and/or modify | ||
1833 | - * it under the terms of the GNU General Public License as published by | ||
1834 | - * the Free Software Foundation, either version 2 of the License, or | ||
1835 | - * (at your option) any later version. | ||
1836 | - * | ||
1837 | - * This program is distributed in the hope that it will be useful, | ||
1838 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1839 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1840 | - * GNU General Public License for more details. | ||
1841 | - * | ||
1842 | - * You should have received a copy of the GNU General Public License | ||
1843 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1844 | -*/ | ||
1845 | - | ||
1846 | -#include <config.h> | ||
1847 | -#include <common.h> | ||
1848 | -#include <asm/processor.h> | ||
1849 | - | ||
1850 | - | ||
1851 | -int checkboard(void) | ||
1852 | -{ | ||
1853 | - puts("Xilinx ML507 Board\n"); | ||
1854 | - return 0; | ||
1855 | -} | ||
1856 | diff --git a/board/xilinx/ml507/xparameters.h b/board/xilinx/ml507/xparameters.h | ||
1857 | deleted file mode 100644 | ||
1858 | index 1992fff..0000000 | ||
1859 | --- a/board/xilinx/ml507/xparameters.h | ||
1860 | +++ /dev/null | ||
1861 | @@ -1,34 +0,0 @@ | ||
1862 | -/* | ||
1863 | - * (C) Copyright 2008 | ||
1864 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1865 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
1866 | - * based on xparameters-ml507.h by Xilinx | ||
1867 | - * | ||
1868 | - * This program is free software: you can redistribute it and/or modify | ||
1869 | - * it under the terms of the GNU General Public License as published by | ||
1870 | - * the Free Software Foundation, either version 2 of the License, or | ||
1871 | - * (at your option) any later version. | ||
1872 | - * | ||
1873 | - * This program is distributed in the hope that it will be useful, | ||
1874 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1875 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1876 | - * GNU General Public License for more details. | ||
1877 | - * | ||
1878 | - * You should have received a copy of the GNU General Public License | ||
1879 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1880 | -*/ | ||
1881 | - | ||
1882 | -#ifndef XPARAMETER_H | ||
1883 | -#define XPARAMETER_H | ||
1884 | - | ||
1885 | -#define XPAR_DDR2_SDRAM_MEM_BASEADDR 0x00000000 | ||
1886 | -#define XPAR_IIC_EEPROM_BASEADDR 0x81600000 | ||
1887 | -#define XPAR_INTC_0_BASEADDR 0x81800000 | ||
1888 | -#define XPAR_UARTLITE_0_BASEADDR 0x84000000 | ||
1889 | -#define XPAR_FLASH_MEM0_BASEADDR 0xFE000000 | ||
1890 | -#define XPAR_PLB_CLOCK_FREQ_HZ 100000000 | ||
1891 | -#define XPAR_CORE_CLOCK_FREQ_HZ 400000000 | ||
1892 | -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 13 | ||
1893 | -#define XPAR_UARTLITE_0_BAUDRATE 9600 | ||
1894 | - | ||
1895 | -#endif | ||
1896 | diff --git a/board/xilinx/ppc405-generic/.gitignore b/board/xilinx/ppc405-generic/.gitignore | ||
1897 | index b644f59..739c63e 100644 | ||
1898 | --- a/board/xilinx/ppc405-generic/.gitignore | ||
1899 | +++ b/board/xilinx/ppc405-generic/.gitignore | ||
1900 | @@ -1 +1,5 @@ | ||
1901 | -config.tmp | ||
1902 | +config.mk | ||
1903 | +dts | ||
1904 | +Makefile | ||
1905 | +microblaze-generic.c | ||
1906 | +xparameters.h | ||
1907 | diff --git a/board/xilinx/ppc405-generic/Makefile b/board/xilinx/ppc405-generic/Makefile | ||
1908 | index 73d5145..9557159 100644 | ||
1909 | --- a/board/xilinx/ppc405-generic/Makefile | ||
1910 | +++ b/board/xilinx/ppc405-generic/Makefile | ||
1911 | @@ -2,10 +2,6 @@ | ||
1912 | # (C) Copyright 2000-2006 | ||
1913 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
1914 | # | ||
1915 | -# (C) Copyright 2008 | ||
1916 | -# Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1917 | -# Work supported by Qtechnology http://www.qtec.com | ||
1918 | -# | ||
1919 | # See file CREDITS for list of people who contributed to this | ||
1920 | # project. | ||
1921 | # | ||
1922 | @@ -26,20 +22,17 @@ | ||
1923 | # | ||
1924 | |||
1925 | include $(TOPDIR)/config.mk | ||
1926 | -ifneq ($(OBJTREE),$(SRCTREE)) | ||
1927 | -$(shell mkdir -p $(obj)../../xilinx/ppc405-generic) | ||
1928 | -endif | ||
1929 | |||
1930 | LIB = $(obj)lib$(BOARD).o | ||
1931 | |||
1932 | -COBJS += ../../xilinx/ppc405-generic/xilinx_ppc405_generic.o | ||
1933 | +COBJS = ppc405-generic.o | ||
1934 | |||
1935 | SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | ||
1936 | OBJS := $(addprefix $(obj),$(COBJS)) | ||
1937 | SOBJS := $(addprefix $(obj),$(SOBJS)) | ||
1938 | |||
1939 | $(LIB): $(obj).depend $(OBJS) $(SOBJS) | ||
1940 | - $(call cmd_link_o_target, $(OBJS)) | ||
1941 | + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) | ||
1942 | |||
1943 | ######################################################################### | ||
1944 | |||
1945 | diff --git a/board/xilinx/ppc405-generic/ppc405-generic.c b/board/xilinx/ppc405-generic/ppc405-generic.c | ||
1946 | new file mode 100644 | ||
1947 | index 0000000..31e635c | ||
1948 | --- /dev/null | ||
1949 | +++ b/board/xilinx/ppc405-generic/ppc405-generic.c | ||
1950 | @@ -0,0 +1,104 @@ | ||
1951 | +/* | ||
1952 | + * (C) Copyright 2007 Michal Simek | ||
1953 | + * | ||
1954 | + * Michal SIMEK <monstr@monstr.eu> | ||
1955 | + * | ||
1956 | + * See file CREDITS for list of people who contributed to this | ||
1957 | + * project. | ||
1958 | + * | ||
1959 | + * This program is free software; you can redistribute it and/or | ||
1960 | + * modify it under the terms of the GNU General Public License as | ||
1961 | + * published by the Free Software Foundation; either version 2 of | ||
1962 | + * the License, or (at your option) any later version. | ||
1963 | + * | ||
1964 | + * This program is distributed in the hope that it will be useful, | ||
1965 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1966 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1967 | + * GNU General Public License for more details. | ||
1968 | + * | ||
1969 | + * You should have received a copy of the GNU General Public License | ||
1970 | + * along with this program; if not, write to the Free Software | ||
1971 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1972 | + * MA 02111-1307 USA | ||
1973 | + */ | ||
1974 | + | ||
1975 | +/* This is a board specific file. It's OK to include board specific | ||
1976 | + * header files */ | ||
1977 | + | ||
1978 | +#include <common.h> | ||
1979 | +#include <config.h> | ||
1980 | +#include <netdev.h> | ||
1981 | + | ||
1982 | +ulong __get_PCI_freq(void) | ||
1983 | +{ | ||
1984 | + return 0; | ||
1985 | +} | ||
1986 | + | ||
1987 | +ulong get_PCI_freq(void) __attribute__((weak, alias("__get_PCI_freq"))); | ||
1988 | + | ||
1989 | +phys_size_t __initdram(int board_type) | ||
1990 | +{ | ||
1991 | + return get_ram_size(XILINX_RAM_START, XILINX_RAM_SIZE); | ||
1992 | +} | ||
1993 | +phys_size_t initdram(int) __attribute__((weak, alias("__initdram"))); | ||
1994 | + | ||
1995 | +void __get_sys_info(sys_info_t *sysInfo) | ||
1996 | +{ | ||
1997 | + /* FIXME */ | ||
1998 | + sysInfo->freqProcessor = XILINX_CLOCK_FREQ; | ||
1999 | + sysInfo->freqPLB = XILINX_CLOCK_FREQ; | ||
2000 | + sysInfo->freqPCI = 0; | ||
2001 | + | ||
2002 | + return; | ||
2003 | +} | ||
2004 | + | ||
2005 | +void get_sys_info(sys_info_t *) __attribute__((weak, alias("__get_sys_info"))); | ||
2006 | + | ||
2007 | +int __checkboard(void) | ||
2008 | +{ | ||
2009 | + puts(__stringify(XILINX_BOARD_NAME) "\n"); | ||
2010 | + return 0; | ||
2011 | +} | ||
2012 | +int checkboard(void) __attribute__((weak, alias("__checkboard"))); | ||
2013 | + | ||
2014 | + | ||
2015 | +int gpio_init (void) | ||
2016 | +{ | ||
2017 | +#ifdef CONFIG_SYS_GPIO_0 | ||
2018 | + *((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF; | ||
2019 | +#endif | ||
2020 | + return 0; | ||
2021 | +} | ||
2022 | + | ||
2023 | +int board_eth_init(bd_t *bis) | ||
2024 | +{ | ||
2025 | + int ret = 0; | ||
2026 | + | ||
2027 | +#ifdef CONFIG_XILINX_EMACLITE | ||
2028 | + u32 txpp = 0; | ||
2029 | + u32 rxpp = 0; | ||
2030 | +# ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG | ||
2031 | + txpp = 1; | ||
2032 | +# endif | ||
2033 | +# ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG | ||
2034 | + rxpp = 1; | ||
2035 | +# endif | ||
2036 | + ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR, | ||
2037 | + txpp, rxpp); | ||
2038 | +#endif | ||
2039 | +#ifdef CONFIG_XILINX_LL_TEMAC | ||
2040 | +# ifdef XILINX_LLTEMAC_FIFO_BASEADDR | ||
2041 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 0, | ||
2042 | + XILINX_LLTEMAC_FIFO_BASEADDR); | ||
2043 | +# elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR | ||
2044 | +# if XILINX_LLTEMAC_SDMA_USE_DCR == 1 | ||
2045 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 3, | ||
2046 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
2047 | +# else | ||
2048 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 1, | ||
2049 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
2050 | +# endif | ||
2051 | +# endif | ||
2052 | +#endif | ||
2053 | + return ret; | ||
2054 | +} | ||
2055 | diff --git a/board/xilinx/ppc405-generic/u-boot.lds b/board/xilinx/ppc405-generic/u-boot.lds | ||
2056 | new file mode 100644 | ||
2057 | index 0000000..7fbbca6 | ||
2058 | --- /dev/null | ||
2059 | +++ b/board/xilinx/ppc405-generic/u-boot.lds | ||
2060 | @@ -0,0 +1,132 @@ | ||
2061 | +/* | ||
2062 | + * (C) Copyright 2000-2004 | ||
2063 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
2064 | + * | ||
2065 | + * See file CREDITS for list of people who contributed to this | ||
2066 | + * project. | ||
2067 | + * | ||
2068 | + * This program is free software; you can redistribute it and/or | ||
2069 | + * modify it under the terms of the GNU General Public License as | ||
2070 | + * published by the Free Software Foundation; either version 2 of | ||
2071 | + * the License, or (at your option) any later version. | ||
2072 | + * | ||
2073 | + * This program is distributed in the hope that it will be useful, | ||
2074 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2075 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2076 | + * GNU General Public License for more details. | ||
2077 | + * | ||
2078 | + * You should have received a copy of the GNU General Public License | ||
2079 | + * along with this program; if not, write to the Free Software | ||
2080 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2081 | + * MA 02111-1307 USA | ||
2082 | + */ | ||
2083 | + | ||
2084 | +OUTPUT_ARCH(powerpc) | ||
2085 | +ENTRY(_start) | ||
2086 | + | ||
2087 | +SECTIONS | ||
2088 | +{ | ||
2089 | + /* Read-only sections, merged into text segment: */ | ||
2090 | + . = + SIZEOF_HEADERS; | ||
2091 | + .interp : { *(.interp) } | ||
2092 | + .hash : { *(.hash) } | ||
2093 | + .dynsym : { *(.dynsym) } | ||
2094 | + .dynstr : { *(.dynstr) } | ||
2095 | + .rel.text : { *(.rel.text) } | ||
2096 | + .rela.text : { *(.rela.text) } | ||
2097 | + .rel.data : { *(.rel.data) } | ||
2098 | + .rela.data : { *(.rela.data) } | ||
2099 | + .rel.rodata : { *(.rel.rodata) } | ||
2100 | + .rela.rodata : { *(.rela.rodata) } | ||
2101 | + .rel.got : { *(.rel.got) } | ||
2102 | + .rela.got : { *(.rela.got) } | ||
2103 | + .rel.ctors : { *(.rel.ctors) } | ||
2104 | + .rela.ctors : { *(.rela.ctors) } | ||
2105 | + .rel.dtors : { *(.rel.dtors) } | ||
2106 | + .rela.dtors : { *(.rela.dtors) } | ||
2107 | + .rel.bss : { *(.rel.bss) } | ||
2108 | + .rela.bss : { *(.rela.bss) } | ||
2109 | + .rel.plt : { *(.rel.plt) } | ||
2110 | + .rela.plt : { *(.rela.plt) } | ||
2111 | + .init : { *(.init) } | ||
2112 | + .plt : { *(.plt) } | ||
2113 | + .text : | ||
2114 | + { | ||
2115 | + /* WARNING - the following is hand-optimized to fit within */ | ||
2116 | + /* the sector layout of our flash chips! XXX FIXME XXX */ | ||
2117 | + | ||
2118 | + | ||
2119 | + *(.text) | ||
2120 | + *(.fixup) | ||
2121 | + *(.got1) | ||
2122 | + } | ||
2123 | + _etext = .; | ||
2124 | + PROVIDE (etext = .); | ||
2125 | + .rodata : | ||
2126 | + { | ||
2127 | + *(.eh_frame) | ||
2128 | + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) | ||
2129 | + } | ||
2130 | + .fini : { *(.fini) } =0 | ||
2131 | + .ctors : { *(.ctors) } | ||
2132 | + .dtors : { *(.dtors) } | ||
2133 | + | ||
2134 | + /* Read-write section, merged into data segment: */ | ||
2135 | + . = (. + 0x00FF) & 0xFFFFFF00; | ||
2136 | + _erotext = .; | ||
2137 | + PROVIDE (erotext = .); | ||
2138 | + .reloc : | ||
2139 | + { | ||
2140 | + *(.got) | ||
2141 | + _GOT2_TABLE_ = .; | ||
2142 | + *(.got2) | ||
2143 | + _FIXUP_TABLE_ = .; | ||
2144 | + *(.fixup) | ||
2145 | + } | ||
2146 | + __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; | ||
2147 | + __fixup_entries = (. - _FIXUP_TABLE_)>>2; | ||
2148 | + | ||
2149 | + .data : | ||
2150 | + { | ||
2151 | + *(.data) | ||
2152 | + *(.data1) | ||
2153 | + *(.sdata) | ||
2154 | + *(.sdata2) | ||
2155 | + *(.dynamic) | ||
2156 | + CONSTRUCTORS | ||
2157 | + } | ||
2158 | + _edata = .; | ||
2159 | + PROVIDE (edata = .); | ||
2160 | + | ||
2161 | + . = .; | ||
2162 | + . = ALIGN(4); | ||
2163 | + .u_boot_list : { | ||
2164 | + #include <u-boot.lst> | ||
2165 | + } | ||
2166 | + | ||
2167 | + . = .; | ||
2168 | + __start___ex_table = .; | ||
2169 | + __ex_table : { *(__ex_table) } | ||
2170 | + __stop___ex_table = .; | ||
2171 | + | ||
2172 | + . = ALIGN(256); | ||
2173 | + __init_begin = .; | ||
2174 | + .text.init : { *(.text.init) } | ||
2175 | + .data.init : { *(.data.init) } | ||
2176 | + . = ALIGN(256); | ||
2177 | + __init_end = .; | ||
2178 | + | ||
2179 | + __bss_start = .; | ||
2180 | + .bss (NOLOAD) : | ||
2181 | + { | ||
2182 | + *(.sbss) *(.scommon) | ||
2183 | + *(.dynbss) | ||
2184 | + *(.bss) | ||
2185 | + *(COMMON) | ||
2186 | + } | ||
2187 | + __bss_end__ = .; | ||
2188 | + ppcenv_assert = ASSERT(. < 0xFFFFB000, ".bss section too big, overlaps .ppcenv section. Please update your configuration: CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_LEN and TEXT_BASE may need to be modified."); | ||
2189 | + | ||
2190 | + _end = . ; | ||
2191 | + PROVIDE (end = .); | ||
2192 | +} | ||
2193 | diff --git a/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c b/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c | ||
2194 | deleted file mode 100644 | ||
2195 | index 9bd1770..0000000 | ||
2196 | --- a/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c | ||
2197 | +++ /dev/null | ||
2198 | @@ -1,59 +0,0 @@ | ||
2199 | -/* | ||
2200 | - * (C) Copyright 2008 | ||
2201 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
2202 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
2203 | - * | ||
2204 | - * This program is free software: you can redistribute it and/or modify | ||
2205 | - * it under the terms of the GNU General Public License as published by | ||
2206 | - * the Free Software Foundation, either version 2 of the License, or | ||
2207 | - * (at your option) any later version. | ||
2208 | - * | ||
2209 | - * This program is distributed in the hope that it will be useful, | ||
2210 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2211 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2212 | - * GNU General Public License for more details. | ||
2213 | - * | ||
2214 | - * You should have received a copy of the GNU General Public License | ||
2215 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2216 | -*/ | ||
2217 | - | ||
2218 | -#include <config.h> | ||
2219 | -#include <common.h> | ||
2220 | -#include <asm/processor.h> | ||
2221 | - | ||
2222 | -ulong __get_PCI_freq(void) | ||
2223 | -{ | ||
2224 | - return 0; | ||
2225 | -} | ||
2226 | - | ||
2227 | -ulong get_PCI_freq(void) __attribute__((weak, alias("__get_PCI_freq"))); | ||
2228 | - | ||
2229 | -int __board_pre_init(void) | ||
2230 | -{ | ||
2231 | - return 0; | ||
2232 | -} | ||
2233 | -int board_pre_init(void) __attribute__((weak, alias("__board_pre_init"))); | ||
2234 | - | ||
2235 | -int __checkboard(void) | ||
2236 | -{ | ||
2237 | - puts("Xilinx PPC405 Generic Board\n"); | ||
2238 | - return 0; | ||
2239 | -} | ||
2240 | -int checkboard(void) __attribute__((weak, alias("__checkboard"))); | ||
2241 | - | ||
2242 | -phys_size_t __initdram(int board_type) | ||
2243 | -{ | ||
2244 | - return get_ram_size(XPAR_DDR2_SDRAM_MEM_BASEADDR, | ||
2245 | - CONFIG_SYS_SDRAM_SIZE_MB * 1024 * 1024); | ||
2246 | -} | ||
2247 | -phys_size_t initdram(int) __attribute__((weak, alias("__initdram"))); | ||
2248 | - | ||
2249 | -void __get_sys_info(sys_info_t *sysInfo) | ||
2250 | -{ | ||
2251 | - sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ; | ||
2252 | - sysInfo->freqPLB = XPAR_PLB_CLOCK_FREQ_HZ; | ||
2253 | - sysInfo->freqPCI = 0; | ||
2254 | - | ||
2255 | - return; | ||
2256 | -} | ||
2257 | -void get_sys_info(sys_info_t *) __attribute__((weak, alias("__get_sys_info"))); | ||
2258 | diff --git a/board/xilinx/ppc405-generic/xparameters.h b/board/xilinx/ppc405-generic/xparameters.h | ||
2259 | deleted file mode 100644 | ||
2260 | index e8e8ced..0000000 | ||
2261 | --- a/board/xilinx/ppc405-generic/xparameters.h | ||
2262 | +++ /dev/null | ||
2263 | @@ -1,36 +0,0 @@ | ||
2264 | -/* | ||
2265 | - * (C) Copyright 2008 | ||
2266 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
2267 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
2268 | - * based on xparameters-ml507.h by Xilinx | ||
2269 | - * | ||
2270 | - * This program is free software: you can redistribute it and/or modify | ||
2271 | - * it under the terms of the GNU General Public License as published by | ||
2272 | - * the Free Software Foundation, either version 2 of the License, or | ||
2273 | - * (at your option) any later version. | ||
2274 | - * | ||
2275 | - * This program is distributed in the hope that it will be useful, | ||
2276 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2277 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2278 | - * GNU General Public License for more details. | ||
2279 | - * | ||
2280 | - * You should have received a copy of the GNU General Public License | ||
2281 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2282 | -*/ | ||
2283 | - | ||
2284 | -#ifndef XPARAMETER_H | ||
2285 | -#define XPARAMETER_H | ||
2286 | - | ||
2287 | -#define XPAR_DDR2_SDRAM_MEM_BASEADDR 0x00000000 | ||
2288 | -#define XPAR_IIC_EEPROM_BASEADDR 0x81600000 | ||
2289 | -#define XPAR_INTC_0_BASEADDR 0x81800000 | ||
2290 | -#define XPAR_SPI_0_BASEADDR 0x83400000 | ||
2291 | -#define XPAR_UARTLITE_0_BASEADDR 0x84000000 | ||
2292 | -#define XPAR_FLASH_MEM0_BASEADDR 0xFE000000 | ||
2293 | -#define XPAR_PLB_CLOCK_FREQ_HZ 100000000 | ||
2294 | -#define XPAR_CORE_CLOCK_FREQ_HZ 400000000 | ||
2295 | -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 13 | ||
2296 | -#define XPAR_UARTLITE_0_BAUDRATE 9600 | ||
2297 | -#define XPAR_SPI_0_NUM_TRANSFER_BITS 8 | ||
2298 | - | ||
2299 | -#endif | ||
2300 | diff --git a/board/xilinx/ppc440-generic/.gitignore b/board/xilinx/ppc440-generic/.gitignore | ||
2301 | index f6418a0..739c63e 100644 | ||
2302 | --- a/board/xilinx/ppc440-generic/.gitignore | ||
2303 | +++ b/board/xilinx/ppc440-generic/.gitignore | ||
2304 | @@ -1 +1,5 @@ | ||
2305 | -/config.tmp | ||
2306 | +config.mk | ||
2307 | +dts | ||
2308 | +Makefile | ||
2309 | +microblaze-generic.c | ||
2310 | +xparameters.h | ||
2311 | diff --git a/board/xilinx/ppc440-generic/Makefile b/board/xilinx/ppc440-generic/Makefile | ||
2312 | index 5d2848d..80b34b5 100644 | ||
2313 | --- a/board/xilinx/ppc440-generic/Makefile | ||
2314 | +++ b/board/xilinx/ppc440-generic/Makefile | ||
2315 | @@ -2,10 +2,6 @@ | ||
2316 | # (C) Copyright 2000-2006 | ||
2317 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
2318 | # | ||
2319 | -# (C) Copyright 2008 | ||
2320 | -# Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
2321 | -# Work supported by Qtechnology http://www.qtec.com | ||
2322 | -# | ||
2323 | # See file CREDITS for list of people who contributed to this | ||
2324 | # project. | ||
2325 | # | ||
2326 | @@ -26,21 +22,18 @@ | ||
2327 | # | ||
2328 | |||
2329 | include $(TOPDIR)/config.mk | ||
2330 | -ifneq ($(OBJTREE),$(SRCTREE)) | ||
2331 | -$(shell mkdir -p $(obj)../../xilinx/ppc440-generic) | ||
2332 | -endif | ||
2333 | |||
2334 | LIB = $(obj)lib$(BOARD).o | ||
2335 | |||
2336 | -COBJS += ../../xilinx/ppc440-generic/xilinx_ppc440_generic.o | ||
2337 | -SOBJS += ../../xilinx/ppc440-generic/init.o | ||
2338 | +COBJS = ppc440-generic.o | ||
2339 | +SOBJS = init.o | ||
2340 | |||
2341 | SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | ||
2342 | OBJS := $(addprefix $(obj),$(COBJS)) | ||
2343 | SOBJS := $(addprefix $(obj),$(SOBJS)) | ||
2344 | |||
2345 | $(LIB): $(obj).depend $(OBJS) $(SOBJS) | ||
2346 | - $(call cmd_link_o_target, $(OBJS)) | ||
2347 | + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) | ||
2348 | |||
2349 | ######################################################################### | ||
2350 | |||
2351 | diff --git a/board/xilinx/ppc440-generic/ppc440-generic.c b/board/xilinx/ppc440-generic/ppc440-generic.c | ||
2352 | new file mode 100644 | ||
2353 | index 0000000..b7cd251 | ||
2354 | --- /dev/null | ||
2355 | +++ b/board/xilinx/ppc440-generic/ppc440-generic.c | ||
2356 | @@ -0,0 +1,104 @@ | ||
2357 | +/* | ||
2358 | + * (C) Copyright 2007 Michal Simek | ||
2359 | + * | ||
2360 | + * Michal SIMEK <monstr@monstr.eu> | ||
2361 | + * | ||
2362 | + * See file CREDITS for list of people who contributed to this | ||
2363 | + * project. | ||
2364 | + * | ||
2365 | + * This program is free software; you can redistribute it and/or | ||
2366 | + * modify it under the terms of the GNU General Public License as | ||
2367 | + * published by the Free Software Foundation; either version 2 of | ||
2368 | + * the License, or (at your option) any later version. | ||
2369 | + * | ||
2370 | + * This program is distributed in the hope that it will be useful, | ||
2371 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2372 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2373 | + * GNU General Public License for more details. | ||
2374 | + * | ||
2375 | + * You should have received a copy of the GNU General Public License | ||
2376 | + * along with this program; if not, write to the Free Software | ||
2377 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2378 | + * MA 02111-1307 USA | ||
2379 | + */ | ||
2380 | + | ||
2381 | +/* This is a board specific file. It's OK to include board specific | ||
2382 | + * header files */ | ||
2383 | + | ||
2384 | +#include <common.h> | ||
2385 | +#include <config.h> | ||
2386 | +#include <netdev.h> | ||
2387 | + | ||
2388 | +ulong __get_PCI_freq(void) | ||
2389 | +{ | ||
2390 | + return 0; | ||
2391 | +} | ||
2392 | + | ||
2393 | +ulong get_PCI_freq(void) __attribute__((weak, alias("__get_PCI_freq"))); | ||
2394 | + | ||
2395 | +phys_size_t __initdram(int board_type) | ||
2396 | +{ | ||
2397 | + return get_ram_size(XILINX_RAM_START, XILINX_RAM_SIZE); | ||
2398 | +} | ||
2399 | +phys_size_t initdram(int) __attribute__((weak, alias("__initdram"))); | ||
2400 | + | ||
2401 | +void __get_sys_info(sys_info_t *sysInfo) | ||
2402 | +{ | ||
2403 | + /* FIXME */ | ||
2404 | + sysInfo->freqProcessor = XILINX_CLOCK_FREQ; | ||
2405 | + sysInfo->freqPLB = XILINX_CLOCK_FREQ; | ||
2406 | + sysInfo->freqPCI = 0; | ||
2407 | + | ||
2408 | + return; | ||
2409 | +} | ||
2410 | + | ||
2411 | +void get_sys_info(sys_info_t *) __attribute__((weak, alias("__get_sys_info"))); | ||
2412 | + | ||
2413 | +int __checkboard(void) | ||
2414 | +{ | ||
2415 | + /*puts(__stringify(XILINX_BOARD_NAME) "\n");*/ | ||
2416 | + return 0; | ||
2417 | +} | ||
2418 | +int checkboard(void) __attribute__((weak, alias("__checkboard"))); | ||
2419 | + | ||
2420 | + | ||
2421 | +int gpio_init (void) | ||
2422 | +{ | ||
2423 | +#ifdef CONFIG_SYS_GPIO_0 | ||
2424 | + *((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF; | ||
2425 | +#endif | ||
2426 | + return 0; | ||
2427 | +} | ||
2428 | + | ||
2429 | +int board_eth_init(bd_t *bis) | ||
2430 | +{ | ||
2431 | + int ret = 0; | ||
2432 | + | ||
2433 | +#ifdef CONFIG_XILINX_EMACLITE | ||
2434 | + u32 txpp = 0; | ||
2435 | + u32 rxpp = 0; | ||
2436 | +# ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG | ||
2437 | + txpp = 1; | ||
2438 | +# endif | ||
2439 | +# ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG | ||
2440 | + rxpp = 1; | ||
2441 | +# endif | ||
2442 | + ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR, | ||
2443 | + txpp, rxpp); | ||
2444 | +#endif | ||
2445 | +#ifdef CONFIG_XILINX_LL_TEMAC | ||
2446 | +# ifdef XILINX_LLTEMAC_FIFO_BASEADDR | ||
2447 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 0, | ||
2448 | + XILINX_LLTEMAC_FIFO_BASEADDR); | ||
2449 | +# elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR | ||
2450 | +# if XILINX_LLTEMAC_SDMA_USE_DCR == 1 | ||
2451 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 3, | ||
2452 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
2453 | +# else | ||
2454 | + ret |= xilinx_ll_temac_initialize(bis, XILINX_LLTEMAC_BASEADDR, 1, | ||
2455 | + XILINX_LLTEMAC_SDMA_CTRL_BASEADDR); | ||
2456 | +# endif | ||
2457 | +# endif | ||
2458 | +#endif | ||
2459 | + return ret; | ||
2460 | +} | ||
2461 | diff --git a/board/xilinx/ppc440-generic/u-boot.lds b/board/xilinx/ppc440-generic/u-boot.lds | ||
2462 | new file mode 100644 | ||
2463 | index 0000000..023324d | ||
2464 | --- /dev/null | ||
2465 | +++ b/board/xilinx/ppc440-generic/u-boot.lds | ||
2466 | @@ -0,0 +1,104 @@ | ||
2467 | +/* | ||
2468 | + * (C) Copyright 2000-2004 | ||
2469 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||
2470 | + * | ||
2471 | + * See file CREDITS for list of people who contributed to this | ||
2472 | + * project. | ||
2473 | + * | ||
2474 | + * This program is free software; you can redistribute it and/or | ||
2475 | + * modify it under the terms of the GNU General Public License as | ||
2476 | + * published by the Free Software Foundation; either version 2 of | ||
2477 | + * the License, or (at your option) any later version. | ||
2478 | + * | ||
2479 | + * This program is distributed in the hope that it will be useful, | ||
2480 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2481 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2482 | + * GNU General Public License for more details. | ||
2483 | + * | ||
2484 | + * You should have received a copy of the GNU General Public License | ||
2485 | + * along with this program; if not, write to the Free Software | ||
2486 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2487 | + * MA 02111-1307 USA | ||
2488 | + */ | ||
2489 | + | ||
2490 | +OUTPUT_ARCH(powerpc) | ||
2491 | +ENTRY(_start_440) | ||
2492 | + | ||
2493 | + | ||
2494 | +PHDRS | ||
2495 | +{ | ||
2496 | + text PT_LOAD; | ||
2497 | + bss PT_LOAD; | ||
2498 | +} | ||
2499 | + | ||
2500 | +SECTIONS | ||
2501 | +{ | ||
2502 | + /* Read-only sections, merged into text segment: */ | ||
2503 | + . = + SIZEOF_HEADERS; | ||
2504 | + .text : | ||
2505 | + { | ||
2506 | + *(.text*) | ||
2507 | + } :text | ||
2508 | + _etext = .; | ||
2509 | + PROVIDE (etext = .); | ||
2510 | + .rodata : | ||
2511 | + { | ||
2512 | + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) | ||
2513 | + } :text | ||
2514 | + | ||
2515 | + | ||
2516 | + /* Read-write section, merged into data segment: */ | ||
2517 | + . = (. + 0x00FF) & 0xFFFFFF00; | ||
2518 | + _erotext = .; | ||
2519 | + PROVIDE (erotext = .); | ||
2520 | + .reloc : | ||
2521 | + { | ||
2522 | + _GOT2_TABLE_ = .; | ||
2523 | + KEEP(*(.got2)) | ||
2524 | + KEEP(*(.got)) | ||
2525 | + PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); | ||
2526 | + _FIXUP_TABLE_ = .; | ||
2527 | + KEEP(*(.fixup)) | ||
2528 | + } | ||
2529 | + __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1; | ||
2530 | + __fixup_entries = (. - _FIXUP_TABLE_) >> 2; | ||
2531 | + | ||
2532 | + .data : | ||
2533 | + { | ||
2534 | + *(.data*) | ||
2535 | + *(.sdata*) | ||
2536 | + } | ||
2537 | + _edata = .; | ||
2538 | + PROVIDE (edata = .); | ||
2539 | + | ||
2540 | + . = .; | ||
2541 | + . = ALIGN(4); | ||
2542 | + .u_boot_list : { | ||
2543 | + #include <u-boot.lst> | ||
2544 | + } | ||
2545 | + | ||
2546 | + . = .; | ||
2547 | + __start___ex_table = .; | ||
2548 | + __ex_table : { *(__ex_table) } | ||
2549 | + __stop___ex_table = .; | ||
2550 | + | ||
2551 | + . = ALIGN(256); | ||
2552 | + __init_begin = .; | ||
2553 | + .text.init : { *(.text.init) } | ||
2554 | + .data.init : { *(.data.init) } | ||
2555 | + . = ALIGN(256); | ||
2556 | + __init_end = .; | ||
2557 | + | ||
2558 | + __bss_start = .; | ||
2559 | + .bss (NOLOAD) : | ||
2560 | + { | ||
2561 | + *(.bss*) | ||
2562 | + *(.sbss*) | ||
2563 | + *(COMMON) | ||
2564 | + } :bss | ||
2565 | + . = ALIGN(4); | ||
2566 | + __bss_end__ = .; | ||
2567 | + ppcenv_assert = ASSERT(. < 0xFFFFB000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_LEN and TEXT_BASE may need to be modified."); | ||
2568 | + | ||
2569 | + PROVIDE (end = .); | ||
2570 | +} | ||
2571 | diff --git a/board/xilinx/ppc440-generic/xilinx_ppc440_generic.c b/board/xilinx/ppc440-generic/xilinx_ppc440_generic.c | ||
2572 | deleted file mode 100644 | ||
2573 | index 0c3d667..0000000 | ||
2574 | --- a/board/xilinx/ppc440-generic/xilinx_ppc440_generic.c | ||
2575 | +++ /dev/null | ||
2576 | @@ -1,52 +0,0 @@ | ||
2577 | -/* | ||
2578 | - * (C) Copyright 2008 | ||
2579 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
2580 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
2581 | - * | ||
2582 | - * This program is free software: you can redistribute it and/or modify | ||
2583 | - * it under the terms of the GNU General Public License as published by | ||
2584 | - * the Free Software Foundation, either version 2 of the License, or | ||
2585 | - * (at your option) any later version. | ||
2586 | - * | ||
2587 | - * This program is distributed in the hope that it will be useful, | ||
2588 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2589 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2590 | - * GNU General Public License for more details. | ||
2591 | - * | ||
2592 | - * You should have received a copy of the GNU General Public License | ||
2593 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2594 | -*/ | ||
2595 | - | ||
2596 | -#include <config.h> | ||
2597 | -#include <common.h> | ||
2598 | -#include <asm/processor.h> | ||
2599 | - | ||
2600 | -int __board_pre_init(void) | ||
2601 | -{ | ||
2602 | - return 0; | ||
2603 | -} | ||
2604 | -int board_pre_init(void) __attribute__((weak, alias("__board_pre_init"))); | ||
2605 | - | ||
2606 | -int __checkboard(void) | ||
2607 | -{ | ||
2608 | - puts("Xilinx PPC440 Generic Board\n"); | ||
2609 | - return 0; | ||
2610 | -} | ||
2611 | -int checkboard(void) __attribute__((weak, alias("__checkboard"))); | ||
2612 | - | ||
2613 | -phys_size_t __initdram(int board_type) | ||
2614 | -{ | ||
2615 | - return get_ram_size(XPAR_DDR2_SDRAM_MEM_BASEADDR, | ||
2616 | - CONFIG_SYS_SDRAM_SIZE_MB * 1024 * 1024); | ||
2617 | -} | ||
2618 | -phys_size_t initdram(int) __attribute__((weak, alias("__initdram"))); | ||
2619 | - | ||
2620 | -void __get_sys_info(sys_info_t *sysInfo) | ||
2621 | -{ | ||
2622 | - sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ; | ||
2623 | - sysInfo->freqPLB = XPAR_PLB_CLOCK_FREQ_HZ; | ||
2624 | - sysInfo->freqPCI = 0; | ||
2625 | - | ||
2626 | - return; | ||
2627 | -} | ||
2628 | -void get_sys_info(sys_info_t *) __attribute__((weak, alias("__get_sys_info"))); | ||
2629 | diff --git a/board/xilinx/ppc440-generic/xparameters.h b/board/xilinx/ppc440-generic/xparameters.h | ||
2630 | deleted file mode 100644 | ||
2631 | index 1992fff..0000000 | ||
2632 | --- a/board/xilinx/ppc440-generic/xparameters.h | ||
2633 | +++ /dev/null | ||
2634 | @@ -1,34 +0,0 @@ | ||
2635 | -/* | ||
2636 | - * (C) Copyright 2008 | ||
2637 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
2638 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
2639 | - * based on xparameters-ml507.h by Xilinx | ||
2640 | - * | ||
2641 | - * This program is free software: you can redistribute it and/or modify | ||
2642 | - * it under the terms of the GNU General Public License as published by | ||
2643 | - * the Free Software Foundation, either version 2 of the License, or | ||
2644 | - * (at your option) any later version. | ||
2645 | - * | ||
2646 | - * This program is distributed in the hope that it will be useful, | ||
2647 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2648 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2649 | - * GNU General Public License for more details. | ||
2650 | - * | ||
2651 | - * You should have received a copy of the GNU General Public License | ||
2652 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2653 | -*/ | ||
2654 | - | ||
2655 | -#ifndef XPARAMETER_H | ||
2656 | -#define XPARAMETER_H | ||
2657 | - | ||
2658 | -#define XPAR_DDR2_SDRAM_MEM_BASEADDR 0x00000000 | ||
2659 | -#define XPAR_IIC_EEPROM_BASEADDR 0x81600000 | ||
2660 | -#define XPAR_INTC_0_BASEADDR 0x81800000 | ||
2661 | -#define XPAR_UARTLITE_0_BASEADDR 0x84000000 | ||
2662 | -#define XPAR_FLASH_MEM0_BASEADDR 0xFE000000 | ||
2663 | -#define XPAR_PLB_CLOCK_FREQ_HZ 100000000 | ||
2664 | -#define XPAR_CORE_CLOCK_FREQ_HZ 400000000 | ||
2665 | -#define XPAR_INTC_MAX_NUM_INTR_INPUTS 13 | ||
2666 | -#define XPAR_UARTLITE_0_BAUDRATE 9600 | ||
2667 | - | ||
2668 | -#endif | ||
2669 | diff --git a/board/xilinx/xilinx_iic/xiic_l.c b/board/xilinx/xilinx_iic/xiic_l.c | ||
2670 | deleted file mode 100644 | ||
2671 | index 6b78163..0000000 | ||
2672 | --- a/board/xilinx/xilinx_iic/xiic_l.c | ||
2673 | +++ /dev/null | ||
2674 | @@ -1,484 +0,0 @@ | ||
2675 | -/* $Id: xiic_l.c,v 1.2 2002/12/05 19:32:40 meinelte Exp $ */ | ||
2676 | -/****************************************************************************** | ||
2677 | -* | ||
2678 | -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" | ||
2679 | -* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND | ||
2680 | -* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, | ||
2681 | -* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, | ||
2682 | -* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION | ||
2683 | -* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, | ||
2684 | -* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE | ||
2685 | -* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY | ||
2686 | -* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE | ||
2687 | -* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR | ||
2688 | -* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF | ||
2689 | -* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
2690 | -* FOR A PARTICULAR PURPOSE. | ||
2691 | -* | ||
2692 | -* (c) Copyright 2002 Xilinx Inc. | ||
2693 | -* All rights reserved. | ||
2694 | -* | ||
2695 | -******************************************************************************/ | ||
2696 | -/*****************************************************************************/ | ||
2697 | -/** | ||
2698 | -* | ||
2699 | -* @file xiic_l.c | ||
2700 | -* | ||
2701 | -* This file contains low-level driver functions that can be used to access the | ||
2702 | -* device. The user should refer to the hardware device specification for more | ||
2703 | -* details of the device operation. | ||
2704 | -* | ||
2705 | -* <pre> | ||
2706 | -* MODIFICATION HISTORY: | ||
2707 | -* | ||
2708 | -* Ver Who Date Changes | ||
2709 | -* ----- --- ------- ----------------------------------------------- | ||
2710 | -* 1.01b jhl 5/13/02 First release | ||
2711 | -* 1.01b jhl 10/14/02 Corrected bug in the receive function, the setup of the | ||
2712 | -* interrupt status mask was not being done in the loop such | ||
2713 | -* that a read would sometimes fail on the last byte because | ||
2714 | -* the transmit error which should have been ignored was | ||
2715 | -* being used. This would leave an extra byte in the FIFO | ||
2716 | -* and the bus throttled such that the next operation would | ||
2717 | -* also fail. Also updated the receive function to not | ||
2718 | -* disable the device after the last byte until after the | ||
2719 | -* bus transitions to not busy which is more consistent | ||
2720 | -* with the expected behavior. | ||
2721 | -* 1.01c ecm 12/05/02 new rev | ||
2722 | -* </pre> | ||
2723 | -* | ||
2724 | -****************************************************************************/ | ||
2725 | - | ||
2726 | -/***************************** Include Files *******************************/ | ||
2727 | - | ||
2728 | -#include "xbasic_types.h" | ||
2729 | -#include "xio.h" | ||
2730 | -#include "xipif_v1_23_b.h" | ||
2731 | -#include "xiic_l.h" | ||
2732 | - | ||
2733 | -/************************** Constant Definitions ***************************/ | ||
2734 | - | ||
2735 | -/**************************** Type Definitions *****************************/ | ||
2736 | - | ||
2737 | - | ||
2738 | -/***************** Macros (Inline Functions) Definitions *******************/ | ||
2739 | - | ||
2740 | - | ||
2741 | -/****************************************************************************** | ||
2742 | -* | ||
2743 | -* This macro clears the specified interrupt in the IPIF interrupt status | ||
2744 | -* register. It is non-destructive in that the register is read and only the | ||
2745 | -* interrupt specified is cleared. Clearing an interrupt acknowledges it. | ||
2746 | -* | ||
2747 | -* @param BaseAddress contains the IPIF registers base address. | ||
2748 | -* | ||
2749 | -* @param InterruptMask contains the interrupts to be disabled | ||
2750 | -* | ||
2751 | -* @return | ||
2752 | -* | ||
2753 | -* None. | ||
2754 | -* | ||
2755 | -* @note | ||
2756 | -* | ||
2757 | -* Signature: void XIic_mClearIisr(u32 BaseAddress, | ||
2758 | -* u32 InterruptMask); | ||
2759 | -* | ||
2760 | -******************************************************************************/ | ||
2761 | -#define XIic_mClearIisr(BaseAddress, InterruptMask) \ | ||
2762 | - XIIF_V123B_WRITE_IISR((BaseAddress), \ | ||
2763 | - XIIF_V123B_READ_IISR(BaseAddress) & (InterruptMask)) | ||
2764 | - | ||
2765 | -/****************************************************************************** | ||
2766 | -* | ||
2767 | -* This macro sends the address for a 7 bit address during both read and write | ||
2768 | -* operations. It takes care of the details to format the address correctly. | ||
2769 | -* This macro is designed to be called internally to the drivers. | ||
2770 | -* | ||
2771 | -* @param SlaveAddress contains the address of the slave to send to. | ||
2772 | -* | ||
2773 | -* @param Operation indicates XIIC_READ_OPERATION or XIIC_WRITE_OPERATION | ||
2774 | -* | ||
2775 | -* @return | ||
2776 | -* | ||
2777 | -* None. | ||
2778 | -* | ||
2779 | -* @note | ||
2780 | -* | ||
2781 | -* Signature: void XIic_mSend7BitAddr(u16 SlaveAddress, u8 Operation); | ||
2782 | -* | ||
2783 | -******************************************************************************/ | ||
2784 | -#define XIic_mSend7BitAddress(BaseAddress, SlaveAddress, Operation) \ | ||
2785 | -{ \ | ||
2786 | - u8 LocalAddr = (u8)(SlaveAddress << 1); \ | ||
2787 | - LocalAddr = (LocalAddr & 0xFE) | (Operation); \ | ||
2788 | - XIo_Out8(BaseAddress + XIIC_DTR_REG_OFFSET, LocalAddr); \ | ||
2789 | -} | ||
2790 | - | ||
2791 | -/************************** Function Prototypes ****************************/ | ||
2792 | - | ||
2793 | -static unsigned RecvData (u32 BaseAddress, u8 * BufferPtr, | ||
2794 | - unsigned ByteCount); | ||
2795 | -static unsigned SendData (u32 BaseAddress, u8 * BufferPtr, | ||
2796 | - unsigned ByteCount); | ||
2797 | - | ||
2798 | -/************************** Variable Definitions **************************/ | ||
2799 | - | ||
2800 | - | ||
2801 | -/****************************************************************************/ | ||
2802 | -/** | ||
2803 | -* Receive data as a master on the IIC bus. This function receives the data | ||
2804 | -* using polled I/O and blocks until the data has been received. It only | ||
2805 | -* supports 7 bit addressing and non-repeated start modes of operation. The | ||
2806 | -* user is responsible for ensuring the bus is not busy if multiple masters | ||
2807 | -* are present on the bus. | ||
2808 | -* | ||
2809 | -* @param BaseAddress contains the base address of the IIC device. | ||
2810 | -* @param Address contains the 7 bit IIC address of the device to send the | ||
2811 | -* specified data to. | ||
2812 | -* @param BufferPtr points to the data to be sent. | ||
2813 | -* @param ByteCount is the number of bytes to be sent. | ||
2814 | -* | ||
2815 | -* @return | ||
2816 | -* | ||
2817 | -* The number of bytes received. | ||
2818 | -* | ||
2819 | -* @note | ||
2820 | -* | ||
2821 | -* None | ||
2822 | -* | ||
2823 | -******************************************************************************/ | ||
2824 | -unsigned XIic_Recv (u32 BaseAddress, u8 Address, | ||
2825 | - u8 * BufferPtr, unsigned ByteCount) | ||
2826 | -{ | ||
2827 | - u8 CntlReg; | ||
2828 | - unsigned RemainingByteCount; | ||
2829 | - | ||
2830 | - /* Tx error is enabled incase the address (7 or 10) has no device to answer | ||
2831 | - * with Ack. When only one byte of data, must set NO ACK before address goes | ||
2832 | - * out therefore Tx error must not be enabled as it will go off immediately | ||
2833 | - * and the Rx full interrupt will be checked. If full, then the one byte | ||
2834 | - * was received and the Tx error will be disabled without sending an error | ||
2835 | - * callback msg. | ||
2836 | - */ | ||
2837 | - XIic_mClearIisr (BaseAddress, | ||
2838 | - XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK | | ||
2839 | - XIIC_INTR_ARB_LOST_MASK); | ||
2840 | - | ||
2841 | - /* Set receive FIFO occupancy depth for 1 byte (zero based) | ||
2842 | - */ | ||
2843 | - XIo_Out8 (BaseAddress + XIIC_RFD_REG_OFFSET, 0); | ||
2844 | - | ||
2845 | - /* 7 bit slave address, send the address for a read operation | ||
2846 | - * and set the state to indicate the address has been sent | ||
2847 | - */ | ||
2848 | - XIic_mSend7BitAddress (BaseAddress, Address, XIIC_READ_OPERATION); | ||
2849 | - | ||
2850 | - /* MSMS gets set after putting data in FIFO. Start the master receive | ||
2851 | - * operation by setting CR Bits MSMS to Master, if the buffer is only one | ||
2852 | - * byte, then it should not be acknowledged to indicate the end of data | ||
2853 | - */ | ||
2854 | - CntlReg = XIIC_CR_MSMS_MASK | XIIC_CR_ENABLE_DEVICE_MASK; | ||
2855 | - if (ByteCount == 1) { | ||
2856 | - CntlReg |= XIIC_CR_NO_ACK_MASK; | ||
2857 | - } | ||
2858 | - | ||
2859 | - /* Write out the control register to start receiving data and call the | ||
2860 | - * function to receive each byte into the buffer | ||
2861 | - */ | ||
2862 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, CntlReg); | ||
2863 | - | ||
2864 | - /* Clear the latched interrupt status for the bus not busy bit which must | ||
2865 | - * be done while the bus is busy | ||
2866 | - */ | ||
2867 | - XIic_mClearIisr (BaseAddress, XIIC_INTR_BNB_MASK); | ||
2868 | - | ||
2869 | - /* Try to receive the data from the IIC bus */ | ||
2870 | - | ||
2871 | - RemainingByteCount = RecvData (BaseAddress, BufferPtr, ByteCount); | ||
2872 | - /* | ||
2873 | - * The receive is complete, disable the IIC device and return the number of | ||
2874 | - * bytes that was received | ||
2875 | - */ | ||
2876 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, 0); | ||
2877 | - | ||
2878 | - /* Return the number of bytes that was received */ | ||
2879 | - | ||
2880 | - return ByteCount - RemainingByteCount; | ||
2881 | -} | ||
2882 | - | ||
2883 | -/****************************************************************************** | ||
2884 | -* | ||
2885 | -* Receive the specified data from the device that has been previously addressed | ||
2886 | -* on the IIC bus. This function assumes that the 7 bit address has been sent | ||
2887 | -* and it should wait for the transmit of the address to complete. | ||
2888 | -* | ||
2889 | -* @param BaseAddress contains the base address of the IIC device. | ||
2890 | -* @param BufferPtr points to the buffer to hold the data that is received. | ||
2891 | -* @param ByteCount is the number of bytes to be received. | ||
2892 | -* | ||
2893 | -* @return | ||
2894 | -* | ||
2895 | -* The number of bytes remaining to be received. | ||
2896 | -* | ||
2897 | -* @note | ||
2898 | -* | ||
2899 | -* This function does not take advantage of the receive FIFO because it is | ||
2900 | -* designed for minimal code space and complexity. It contains loops that | ||
2901 | -* that could cause the function not to return if the hardware is not working. | ||
2902 | -* | ||
2903 | -* This function assumes that the calling function will disable the IIC device | ||
2904 | -* after this function returns. | ||
2905 | -* | ||
2906 | -******************************************************************************/ | ||
2907 | -static unsigned RecvData (u32 BaseAddress, u8 * BufferPtr, unsigned ByteCount) | ||
2908 | -{ | ||
2909 | - u8 CntlReg; | ||
2910 | - u32 IntrStatusMask; | ||
2911 | - u32 IntrStatus; | ||
2912 | - | ||
2913 | - /* Attempt to receive the specified number of bytes on the IIC bus */ | ||
2914 | - | ||
2915 | - while (ByteCount > 0) { | ||
2916 | - /* Setup the mask to use for checking errors because when receiving one | ||
2917 | - * byte OR the last byte of a multibyte message an error naturally | ||
2918 | - * occurs when the no ack is done to tell the slave the last byte | ||
2919 | - */ | ||
2920 | - if (ByteCount == 1) { | ||
2921 | - IntrStatusMask = | ||
2922 | - XIIC_INTR_ARB_LOST_MASK | XIIC_INTR_BNB_MASK; | ||
2923 | - } else { | ||
2924 | - IntrStatusMask = | ||
2925 | - XIIC_INTR_ARB_LOST_MASK | | ||
2926 | - XIIC_INTR_TX_ERROR_MASK | XIIC_INTR_BNB_MASK; | ||
2927 | - } | ||
2928 | - | ||
2929 | - /* Wait for the previous transmit and the 1st receive to complete | ||
2930 | - * by checking the interrupt status register of the IPIF | ||
2931 | - */ | ||
2932 | - while (1) { | ||
2933 | - IntrStatus = XIIF_V123B_READ_IISR (BaseAddress); | ||
2934 | - if (IntrStatus & XIIC_INTR_RX_FULL_MASK) { | ||
2935 | - break; | ||
2936 | - } | ||
2937 | - /* Check the transmit error after the receive full because when | ||
2938 | - * sending only one byte transmit error will occur because of the | ||
2939 | - * no ack to indicate the end of the data | ||
2940 | - */ | ||
2941 | - if (IntrStatus & IntrStatusMask) { | ||
2942 | - return ByteCount; | ||
2943 | - } | ||
2944 | - } | ||
2945 | - | ||
2946 | - CntlReg = XIo_In8 (BaseAddress + XIIC_CR_REG_OFFSET); | ||
2947 | - | ||
2948 | - /* Special conditions exist for the last two bytes so check for them | ||
2949 | - * Note that the control register must be setup for these conditions | ||
2950 | - * before the data byte which was already received is read from the | ||
2951 | - * receive FIFO (while the bus is throttled | ||
2952 | - */ | ||
2953 | - if (ByteCount == 1) { | ||
2954 | - /* For the last data byte, it has already been read and no ack | ||
2955 | - * has been done, so clear MSMS while leaving the device enabled | ||
2956 | - * so it can get off the IIC bus appropriately with a stop. | ||
2957 | - */ | ||
2958 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, | ||
2959 | - XIIC_CR_ENABLE_DEVICE_MASK); | ||
2960 | - } | ||
2961 | - | ||
2962 | - /* Before the last byte is received, set NOACK to tell the slave IIC | ||
2963 | - * device that it is the end, this must be done before reading the byte | ||
2964 | - * from the FIFO | ||
2965 | - */ | ||
2966 | - if (ByteCount == 2) { | ||
2967 | - /* Write control reg with NO ACK allowing last byte to | ||
2968 | - * have the No ack set to indicate to slave last byte read. | ||
2969 | - */ | ||
2970 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, | ||
2971 | - CntlReg | XIIC_CR_NO_ACK_MASK); | ||
2972 | - } | ||
2973 | - | ||
2974 | - /* Read in data from the FIFO and unthrottle the bus such that the | ||
2975 | - * next byte is read from the IIC bus | ||
2976 | - */ | ||
2977 | - *BufferPtr++ = XIo_In8 (BaseAddress + XIIC_DRR_REG_OFFSET); | ||
2978 | - | ||
2979 | - /* Clear the latched interrupt status so that it will be updated with | ||
2980 | - * the new state when it changes, this must be done after the receive | ||
2981 | - * register is read | ||
2982 | - */ | ||
2983 | - XIic_mClearIisr (BaseAddress, XIIC_INTR_RX_FULL_MASK | | ||
2984 | - XIIC_INTR_TX_ERROR_MASK | | ||
2985 | - XIIC_INTR_ARB_LOST_MASK); | ||
2986 | - ByteCount--; | ||
2987 | - } | ||
2988 | - | ||
2989 | - /* Wait for the bus to transition to not busy before returning, the IIC | ||
2990 | - * device cannot be disabled until this occurs. It should transition as | ||
2991 | - * the MSMS bit of the control register was cleared before the last byte | ||
2992 | - * was read from the FIFO. | ||
2993 | - */ | ||
2994 | - while (1) { | ||
2995 | - if (XIIF_V123B_READ_IISR (BaseAddress) & XIIC_INTR_BNB_MASK) { | ||
2996 | - break; | ||
2997 | - } | ||
2998 | - } | ||
2999 | - | ||
3000 | - return ByteCount; | ||
3001 | -} | ||
3002 | - | ||
3003 | -/****************************************************************************/ | ||
3004 | -/** | ||
3005 | -* Send data as a master on the IIC bus. This function sends the data | ||
3006 | -* using polled I/O and blocks until the data has been sent. It only supports | ||
3007 | -* 7 bit addressing and non-repeated start modes of operation. The user is | ||
3008 | -* responsible for ensuring the bus is not busy if multiple masters are present | ||
3009 | -* on the bus. | ||
3010 | -* | ||
3011 | -* @param BaseAddress contains the base address of the IIC device. | ||
3012 | -* @param Address contains the 7 bit IIC address of the device to send the | ||
3013 | -* specified data to. | ||
3014 | -* @param BufferPtr points to the data to be sent. | ||
3015 | -* @param ByteCount is the number of bytes to be sent. | ||
3016 | -* | ||
3017 | -* @return | ||
3018 | -* | ||
3019 | -* The number of bytes sent. | ||
3020 | -* | ||
3021 | -* @note | ||
3022 | -* | ||
3023 | -* None | ||
3024 | -* | ||
3025 | -******************************************************************************/ | ||
3026 | -unsigned XIic_Send (u32 BaseAddress, u8 Address, | ||
3027 | - u8 * BufferPtr, unsigned ByteCount) | ||
3028 | -{ | ||
3029 | - unsigned RemainingByteCount; | ||
3030 | - | ||
3031 | - /* Put the address into the FIFO to be sent and indicate that the operation | ||
3032 | - * to be performed on the bus is a write operation | ||
3033 | - */ | ||
3034 | - XIic_mSend7BitAddress (BaseAddress, Address, XIIC_WRITE_OPERATION); | ||
3035 | - | ||
3036 | - /* Clear the latched interrupt status so that it will be updated with the | ||
3037 | - * new state when it changes, this must be done after the address is put | ||
3038 | - * in the FIFO | ||
3039 | - */ | ||
3040 | - XIic_mClearIisr (BaseAddress, XIIC_INTR_TX_EMPTY_MASK | | ||
3041 | - XIIC_INTR_TX_ERROR_MASK | XIIC_INTR_ARB_LOST_MASK); | ||
3042 | - | ||
3043 | - /* MSMS must be set after putting data into transmit FIFO, indicate the | ||
3044 | - * direction is transmit, this device is master and enable the IIC device | ||
3045 | - */ | ||
3046 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, | ||
3047 | - XIIC_CR_MSMS_MASK | XIIC_CR_DIR_IS_TX_MASK | | ||
3048 | - XIIC_CR_ENABLE_DEVICE_MASK); | ||
3049 | - | ||
3050 | - /* Clear the latched interrupt | ||
3051 | - * status for the bus not busy bit which must be done while the bus is busy | ||
3052 | - */ | ||
3053 | - XIic_mClearIisr (BaseAddress, XIIC_INTR_BNB_MASK); | ||
3054 | - | ||
3055 | - /* Send the specified data to the device on the IIC bus specified by the | ||
3056 | - * the address | ||
3057 | - */ | ||
3058 | - RemainingByteCount = SendData (BaseAddress, BufferPtr, ByteCount); | ||
3059 | - | ||
3060 | - /* | ||
3061 | - * The send is complete, disable the IIC device and return the number of | ||
3062 | - * bytes that was sent | ||
3063 | - */ | ||
3064 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, 0); | ||
3065 | - | ||
3066 | - return ByteCount - RemainingByteCount; | ||
3067 | -} | ||
3068 | - | ||
3069 | -/****************************************************************************** | ||
3070 | -* | ||
3071 | -* Send the specified buffer to the device that has been previously addressed | ||
3072 | -* on the IIC bus. This function assumes that the 7 bit address has been sent | ||
3073 | -* and it should wait for the transmit of the address to complete. | ||
3074 | -* | ||
3075 | -* @param BaseAddress contains the base address of the IIC device. | ||
3076 | -* @param BufferPtr points to the data to be sent. | ||
3077 | -* @param ByteCount is the number of bytes to be sent. | ||
3078 | -* | ||
3079 | -* @return | ||
3080 | -* | ||
3081 | -* The number of bytes remaining to be sent. | ||
3082 | -* | ||
3083 | -* @note | ||
3084 | -* | ||
3085 | -* This function does not take advantage of the transmit FIFO because it is | ||
3086 | -* designed for minimal code space and complexity. It contains loops that | ||
3087 | -* that could cause the function not to return if the hardware is not working. | ||
3088 | -* | ||
3089 | -******************************************************************************/ | ||
3090 | -static unsigned SendData (u32 BaseAddress, u8 * BufferPtr, unsigned ByteCount) | ||
3091 | -{ | ||
3092 | - u32 IntrStatus; | ||
3093 | - | ||
3094 | - /* Send the specified number of bytes in the specified buffer by polling | ||
3095 | - * the device registers and blocking until complete | ||
3096 | - */ | ||
3097 | - while (ByteCount > 0) { | ||
3098 | - /* Wait for the transmit to be empty before sending any more data | ||
3099 | - * by polling the interrupt status register | ||
3100 | - */ | ||
3101 | - while (1) { | ||
3102 | - IntrStatus = XIIF_V123B_READ_IISR (BaseAddress); | ||
3103 | - | ||
3104 | - if (IntrStatus & (XIIC_INTR_TX_ERROR_MASK | | ||
3105 | - XIIC_INTR_ARB_LOST_MASK | | ||
3106 | - XIIC_INTR_BNB_MASK)) { | ||
3107 | - return ByteCount; | ||
3108 | - } | ||
3109 | - | ||
3110 | - if (IntrStatus & XIIC_INTR_TX_EMPTY_MASK) { | ||
3111 | - break; | ||
3112 | - } | ||
3113 | - } | ||
3114 | - /* If there is more than one byte to send then put the next byte to send | ||
3115 | - * into the transmit FIFO | ||
3116 | - */ | ||
3117 | - if (ByteCount > 1) { | ||
3118 | - XIo_Out8 (BaseAddress + XIIC_DTR_REG_OFFSET, | ||
3119 | - *BufferPtr++); | ||
3120 | - } else { | ||
3121 | - /* Set the stop condition before sending the last byte of data so that | ||
3122 | - * the stop condition will be generated immediately following the data | ||
3123 | - * This is done by clearing the MSMS bit in the control register. | ||
3124 | - */ | ||
3125 | - XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, | ||
3126 | - XIIC_CR_ENABLE_DEVICE_MASK | | ||
3127 | - XIIC_CR_DIR_IS_TX_MASK); | ||
3128 | - | ||
3129 | - /* Put the last byte to send in the transmit FIFO */ | ||
3130 | - | ||
3131 | - XIo_Out8 (BaseAddress + XIIC_DTR_REG_OFFSET, | ||
3132 | - *BufferPtr++); | ||
3133 | - } | ||
3134 | - | ||
3135 | - /* Clear the latched interrupt status register and this must be done after | ||
3136 | - * the transmit FIFO has been written to or it won't clear | ||
3137 | - */ | ||
3138 | - XIic_mClearIisr (BaseAddress, XIIC_INTR_TX_EMPTY_MASK); | ||
3139 | - | ||
3140 | - /* Update the byte count to reflect the byte sent and clear the latched | ||
3141 | - * interrupt status so it will be updated for the new state | ||
3142 | - */ | ||
3143 | - ByteCount--; | ||
3144 | - } | ||
3145 | - | ||
3146 | - /* Wait for the bus to transition to not busy before returning, the IIC | ||
3147 | - * device cannot be disabled until this occurs. | ||
3148 | - * Note that this is different from a receive operation because the stop | ||
3149 | - * condition causes the bus to go not busy. | ||
3150 | - */ | ||
3151 | - while (1) { | ||
3152 | - if (XIIF_V123B_READ_IISR (BaseAddress) & XIIC_INTR_BNB_MASK) { | ||
3153 | - break; | ||
3154 | - } | ||
3155 | - } | ||
3156 | - | ||
3157 | - return ByteCount; | ||
3158 | -} | ||
3159 | diff --git a/board/xilinx/xilinx_iic/xiic_l.h b/board/xilinx/xilinx_iic/xiic_l.h | ||
3160 | deleted file mode 100644 | ||
3161 | index a2c4c49..0000000 | ||
3162 | --- a/board/xilinx/xilinx_iic/xiic_l.h | ||
3163 | +++ /dev/null | ||
3164 | @@ -1,150 +0,0 @@ | ||
3165 | -/* $Id: xiic_l.h,v 1.2 2002/12/05 19:32:40 meinelte Exp $ */ | ||
3166 | -/***************************************************************************** | ||
3167 | -* | ||
3168 | -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" | ||
3169 | -* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND | ||
3170 | -* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, | ||
3171 | -* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, | ||
3172 | -* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION | ||
3173 | -* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, | ||
3174 | -* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE | ||
3175 | -* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY | ||
3176 | -* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE | ||
3177 | -* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR | ||
3178 | -* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF | ||
3179 | -* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
3180 | -* FOR A PARTICULAR PURPOSE. | ||
3181 | -* | ||
3182 | -* (c) Copyright 2002 Xilinx Inc. | ||
3183 | -* All rights reserved. | ||
3184 | -* | ||
3185 | -*****************************************************************************/ | ||
3186 | -/****************************************************************************/ | ||
3187 | -/** | ||
3188 | -* | ||
3189 | -* @file xiic_l.h | ||
3190 | -* | ||
3191 | -* This header file contains identifiers and low-level driver functions (or | ||
3192 | -* macros) that can be used to access the device. High-level driver functions | ||
3193 | -* are defined in xiic.h. | ||
3194 | -* | ||
3195 | -* <pre> | ||
3196 | -* MODIFICATION HISTORY: | ||
3197 | -* | ||
3198 | -* Ver Who Date Changes | ||
3199 | -* ----- ---- -------- ----------------------------------------------- | ||
3200 | -* 1.00b jhl 05/07/02 First release | ||
3201 | -* 1.01c ecm 12/05/02 new rev | ||
3202 | -* </pre> | ||
3203 | -* | ||
3204 | -*****************************************************************************/ | ||
3205 | - | ||
3206 | -#ifndef XIIC_L_H /* prevent circular inclusions */ | ||
3207 | -#define XIIC_L_H /* by using protection macros */ | ||
3208 | - | ||
3209 | -/***************************** Include Files ********************************/ | ||
3210 | - | ||
3211 | -#include "xbasic_types.h" | ||
3212 | - | ||
3213 | -/************************** Constant Definitions ****************************/ | ||
3214 | - | ||
3215 | -#define XIIC_MSB_OFFSET 3 | ||
3216 | - | ||
3217 | -#define XIIC_REG_OFFSET 0x100 + XIIC_MSB_OFFSET | ||
3218 | - | ||
3219 | -/* | ||
3220 | - * Register offsets in bytes from RegisterBase. Three is added to the | ||
3221 | - * base offset to access LSB (IBM style) of the word | ||
3222 | - */ | ||
3223 | -#define XIIC_CR_REG_OFFSET 0x00+XIIC_REG_OFFSET /* Control Register */ | ||
3224 | -#define XIIC_SR_REG_OFFSET 0x04+XIIC_REG_OFFSET /* Status Register */ | ||
3225 | -#define XIIC_DTR_REG_OFFSET 0x08+XIIC_REG_OFFSET /* Data Tx Register */ | ||
3226 | -#define XIIC_DRR_REG_OFFSET 0x0C+XIIC_REG_OFFSET /* Data Rx Register */ | ||
3227 | -#define XIIC_ADR_REG_OFFSET 0x10+XIIC_REG_OFFSET /* Address Register */ | ||
3228 | -#define XIIC_TFO_REG_OFFSET 0x14+XIIC_REG_OFFSET /* Tx FIFO Occupancy */ | ||
3229 | -#define XIIC_RFO_REG_OFFSET 0x18+XIIC_REG_OFFSET /* Rx FIFO Occupancy */ | ||
3230 | -#define XIIC_TBA_REG_OFFSET 0x1C+XIIC_REG_OFFSET /* 10 Bit Address reg */ | ||
3231 | -#define XIIC_RFD_REG_OFFSET 0x20+XIIC_REG_OFFSET /* Rx FIFO Depth reg */ | ||
3232 | - | ||
3233 | -/* Control Register masks */ | ||
3234 | - | ||
3235 | -#define XIIC_CR_ENABLE_DEVICE_MASK 0x01 /* Device enable = 1 */ | ||
3236 | -#define XIIC_CR_TX_FIFO_RESET_MASK 0x02 /* Transmit FIFO reset=1 */ | ||
3237 | -#define XIIC_CR_MSMS_MASK 0x04 /* Master starts Txing=1 */ | ||
3238 | -#define XIIC_CR_DIR_IS_TX_MASK 0x08 /* Dir of tx. Txing=1 */ | ||
3239 | -#define XIIC_CR_NO_ACK_MASK 0x10 /* Tx Ack. NO ack = 1 */ | ||
3240 | -#define XIIC_CR_REPEATED_START_MASK 0x20 /* Repeated start = 1 */ | ||
3241 | -#define XIIC_CR_GENERAL_CALL_MASK 0x40 /* Gen Call enabled = 1 */ | ||
3242 | - | ||
3243 | -/* Status Register masks */ | ||
3244 | - | ||
3245 | -#define XIIC_SR_GEN_CALL_MASK 0x01 /* 1=a mstr issued a GC */ | ||
3246 | -#define XIIC_SR_ADDR_AS_SLAVE_MASK 0x02 /* 1=when addr as slave */ | ||
3247 | -#define XIIC_SR_BUS_BUSY_MASK 0x04 /* 1 = bus is busy */ | ||
3248 | -#define XIIC_SR_MSTR_RDING_SLAVE_MASK 0x08 /* 1=Dir: mstr <-- slave */ | ||
3249 | -#define XIIC_SR_TX_FIFO_FULL_MASK 0x10 /* 1 = Tx FIFO full */ | ||
3250 | -#define XIIC_SR_RX_FIFO_FULL_MASK 0x20 /* 1 = Rx FIFO full */ | ||
3251 | -#define XIIC_SR_RX_FIFO_EMPTY_MASK 0x40 /* 1 = Rx FIFO empty */ | ||
3252 | - | ||
3253 | -/* IPIF Interrupt Status Register masks Interrupt occurs when... */ | ||
3254 | - | ||
3255 | -#define XIIC_INTR_ARB_LOST_MASK 0x01 /* 1 = arbitration lost */ | ||
3256 | -#define XIIC_INTR_TX_ERROR_MASK 0x02 /* 1=Tx error/msg complete*/ | ||
3257 | -#define XIIC_INTR_TX_EMPTY_MASK 0x04 /* 1 = Tx FIFO/reg empty */ | ||
3258 | -#define XIIC_INTR_RX_FULL_MASK 0x08 /* 1=Rx FIFO/reg=OCY level*/ | ||
3259 | -#define XIIC_INTR_BNB_MASK 0x10 /* 1 = Bus not busy */ | ||
3260 | -#define XIIC_INTR_AAS_MASK 0x20 /* 1 = when addr as slave */ | ||
3261 | -#define XIIC_INTR_NAAS_MASK 0x40 /* 1 = not addr as slave */ | ||
3262 | -#define XIIC_INTR_TX_HALF_MASK 0x80 /* 1 = TX FIFO half empty */ | ||
3263 | - | ||
3264 | -/* IPIF Device Interrupt Register masks */ | ||
3265 | - | ||
3266 | -#define XIIC_IPIF_IIC_MASK 0x00000004UL /* 1=inter enabled */ | ||
3267 | -#define XIIC_IPIF_ERROR_MASK 0x00000001UL /* 1=inter enabled */ | ||
3268 | -#define XIIC_IPIF_INTER_ENABLE_MASK (XIIC_IPIF_IIC_MASK | \ | ||
3269 | - XIIC_IPIF_ERROR_MASK) | ||
3270 | - | ||
3271 | -#define XIIC_TX_ADDR_SENT 0x00 | ||
3272 | -#define XIIC_TX_ADDR_MSTR_RECV_MASK 0x02 | ||
3273 | - | ||
3274 | -/* The following constants specify the depth of the FIFOs */ | ||
3275 | - | ||
3276 | -#define IIC_RX_FIFO_DEPTH 16 /* Rx fifo capacity */ | ||
3277 | -#define IIC_TX_FIFO_DEPTH 16 /* Tx fifo capacity */ | ||
3278 | - | ||
3279 | -/* The following constants specify groups of interrupts that are typically | ||
3280 | - * enabled or disables at the same time | ||
3281 | - */ | ||
3282 | -#define XIIC_TX_INTERRUPTS \ | ||
3283 | - (XIIC_INTR_TX_ERROR_MASK | XIIC_INTR_TX_EMPTY_MASK | \ | ||
3284 | - XIIC_INTR_TX_HALF_MASK) | ||
3285 | - | ||
3286 | -#define XIIC_TX_RX_INTERRUPTS (XIIC_INTR_RX_FULL_MASK | XIIC_TX_INTERRUPTS) | ||
3287 | - | ||
3288 | -/* The following constants are used with the following macros to specify the | ||
3289 | - * operation, a read or write operation. | ||
3290 | - */ | ||
3291 | -#define XIIC_READ_OPERATION 1 | ||
3292 | -#define XIIC_WRITE_OPERATION 0 | ||
3293 | - | ||
3294 | -/* The following constants are used with the transmit FIFO fill function to | ||
3295 | - * specify the role which the IIC device is acting as, a master or a slave. | ||
3296 | - */ | ||
3297 | -#define XIIC_MASTER_ROLE 1 | ||
3298 | -#define XIIC_SLAVE_ROLE 0 | ||
3299 | - | ||
3300 | -/**************************** Type Definitions ******************************/ | ||
3301 | - | ||
3302 | - | ||
3303 | -/***************** Macros (Inline Functions) Definitions ********************/ | ||
3304 | - | ||
3305 | - | ||
3306 | -/************************** Function Prototypes *****************************/ | ||
3307 | - | ||
3308 | -unsigned XIic_Recv(u32 BaseAddress, u8 Address, | ||
3309 | - u8 *BufferPtr, unsigned ByteCount); | ||
3310 | - | ||
3311 | -unsigned XIic_Send(u32 BaseAddress, u8 Address, | ||
3312 | - u8 *BufferPtr, unsigned ByteCount); | ||
3313 | - | ||
3314 | -#endif /* end of protection macro */ | ||
3315 | diff --git a/board/xilinx/zynq/Makefile b/board/xilinx/zynq/Makefile | ||
3316 | index ef4faa1..d4814d1 100644 | ||
3317 | --- a/board/xilinx/zynq/Makefile | ||
3318 | +++ b/board/xilinx/zynq/Makefile | ||
3319 | @@ -28,7 +28,7 @@ endif | ||
3320 | |||
3321 | LIB = $(obj)lib$(BOARD).o | ||
3322 | |||
3323 | -COBJS-y := board.o | ||
3324 | +COBJS-y := board.o ../../xilinx/common/xbasic_types.o | ||
3325 | |||
3326 | COBJS := $(sort $(COBJS-y)) | ||
3327 | |||
3328 | @@ -38,12 +38,6 @@ OBJS := $(addprefix $(obj),$(COBJS)) | ||
3329 | $(LIB): $(obj).depend $(OBJS) | ||
3330 | $(call cmd_link_o_target, $(OBJS)) | ||
3331 | |||
3332 | -clean: | ||
3333 | - rm -f $(OBJS) | ||
3334 | - | ||
3335 | -distclean: clean | ||
3336 | - rm -f $(LIB) core *.bak $(obj).depend | ||
3337 | - | ||
3338 | ######################################################################### | ||
3339 | |||
3340 | # defines $(obj).depend target | ||
3341 | diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c | ||
3342 | index 8ed75c3..3bb90f5 100644 | ||
3343 | --- a/board/xilinx/zynq/board.c | ||
3344 | +++ b/board/xilinx/zynq/board.c | ||
3345 | @@ -21,31 +21,154 @@ | ||
3346 | */ | ||
3347 | |||
3348 | #include <common.h> | ||
3349 | +#include <asm/io.h> | ||
3350 | +#include <asm/arch/mmc.h> | ||
3351 | +#include <asm/arch/nand.h> | ||
3352 | #include <netdev.h> | ||
3353 | +#include <zynqpl.h> | ||
3354 | +#include <asm/arch/sys_proto.h> | ||
3355 | |||
3356 | DECLARE_GLOBAL_DATA_PTR; | ||
3357 | |||
3358 | +/* Bootmode setting values */ | ||
3359 | +#define BOOT_MODES_MASK 0x0000000F | ||
3360 | +#define QSPI_MODE 0x00000001 | ||
3361 | +#define NOR_FLASH_MODE 0x00000002 | ||
3362 | +#define NAND_FLASH_MODE 0x00000004 | ||
3363 | +#define SD_MODE 0x00000005 | ||
3364 | +#define JTAG_MODE 0x00000000 | ||
3365 | + | ||
3366 | +#ifdef CONFIG_FPGA | ||
3367 | +Xilinx_desc fpga; | ||
3368 | + | ||
3369 | +/* It can be done differently */ | ||
3370 | +Xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10); | ||
3371 | +Xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20); | ||
3372 | +Xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30); | ||
3373 | +Xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45); | ||
3374 | +#endif | ||
3375 | + | ||
3376 | int board_init(void) | ||
3377 | { | ||
3378 | +#ifdef CONFIG_FPGA | ||
3379 | + u32 idcode; | ||
3380 | + | ||
3381 | + idcode = zynq_slcr_get_idcode(); | ||
3382 | + | ||
3383 | + switch (idcode) { | ||
3384 | + case XILINX_ZYNQ_7010: | ||
3385 | + fpga = fpga010; | ||
3386 | + break; | ||
3387 | + case XILINX_ZYNQ_7020: | ||
3388 | + fpga = fpga020; | ||
3389 | + break; | ||
3390 | + case XILINX_ZYNQ_7030: | ||
3391 | + fpga = fpga030; | ||
3392 | + break; | ||
3393 | + case XILINX_ZYNQ_7045: | ||
3394 | + fpga = fpga045; | ||
3395 | + break; | ||
3396 | + } | ||
3397 | +#endif | ||
3398 | + | ||
3399 | + /* temporary hack to clear pending irqs before Linux as it | ||
3400 | + * will hang Linux | ||
3401 | + */ | ||
3402 | + writel(0x26d, 0xe0001014); | ||
3403 | + | ||
3404 | + /* temporary hack to take USB out of reset til the is fixed | ||
3405 | + * in Linux | ||
3406 | + */ | ||
3407 | + writel(0x80, 0xe000a204); | ||
3408 | + writel(0x80, 0xe000a208); | ||
3409 | + writel(0x80, 0xe000a040); | ||
3410 | + writel(0x00, 0xe000a040); | ||
3411 | + writel(0x80, 0xe000a040); | ||
3412 | + | ||
3413 | icache_enable(); | ||
3414 | |||
3415 | +#ifdef CONFIG_FPGA | ||
3416 | + fpga_init(); | ||
3417 | + fpga_add(fpga_xilinx, &fpga); | ||
3418 | +#endif | ||
3419 | + | ||
3420 | return 0; | ||
3421 | } | ||
3422 | |||
3423 | +int board_late_init(void) | ||
3424 | +{ | ||
3425 | + switch ((zynq_slcr_get_boot_mode()) & BOOT_MODES_MASK) { | ||
3426 | + case QSPI_MODE: | ||
3427 | + setenv("modeboot", "qspiboot"); | ||
3428 | + break; | ||
3429 | + case NAND_FLASH_MODE: | ||
3430 | + setenv("modeboot", "nandboot"); | ||
3431 | + break; | ||
3432 | + case NOR_FLASH_MODE: | ||
3433 | + setenv("modeboot", "norboot"); | ||
3434 | + break; | ||
3435 | + case SD_MODE: | ||
3436 | + setenv("modeboot", "sdboot"); | ||
3437 | + break; | ||
3438 | + case JTAG_MODE: | ||
3439 | + setenv("modeboot", "jtagboot"); | ||
3440 | + break; | ||
3441 | + default: | ||
3442 | + setenv("modeboot", ""); | ||
3443 | + break; | ||
3444 | + } | ||
3445 | + | ||
3446 | + return 0; | ||
3447 | +} | ||
3448 | |||
3449 | #ifdef CONFIG_CMD_NET | ||
3450 | int board_eth_init(bd_t *bis) | ||
3451 | { | ||
3452 | u32 ret = 0; | ||
3453 | |||
3454 | -#if defined(CONFIG_ZYNQ_GEM) && defined(CONFIG_ZYNQ_GEM_BASEADDR0) | ||
3455 | - ret = zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0); | ||
3456 | +#ifdef CONFIG_XILINX_AXIEMAC | ||
3457 | + ret |= xilinx_axiemac_initialize(bis, XILINX_AXIEMAC_BASEADDR, | ||
3458 | + XILINX_AXIDMA_BASEADDR); | ||
3459 | +#endif | ||
3460 | +#ifdef CONFIG_XILINX_EMACLITE | ||
3461 | + u32 txpp = 0; | ||
3462 | + u32 rxpp = 0; | ||
3463 | +# ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG | ||
3464 | + txpp = 1; | ||
3465 | +# endif | ||
3466 | +# ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG | ||
3467 | + rxpp = 1; | ||
3468 | +# endif | ||
3469 | + ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR, | ||
3470 | + txpp, rxpp); | ||
3471 | #endif | ||
3472 | |||
3473 | +#if defined(CONFIG_ZYNQ_GEM) | ||
3474 | +# if defined(CONFIG_ZYNQ_GEM_BASEADDR0) | ||
3475 | + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0); | ||
3476 | +# endif | ||
3477 | +# if defined(CONFIG_ZYNQ_GEM_BASEADDR1) | ||
3478 | + ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1); | ||
3479 | +# endif | ||
3480 | +#endif | ||
3481 | return ret; | ||
3482 | } | ||
3483 | #endif | ||
3484 | |||
3485 | +#ifdef CONFIG_CMD_MMC | ||
3486 | +int board_mmc_init(bd_t *bd) | ||
3487 | +{ | ||
3488 | + return zynq_mmc_init(bd); | ||
3489 | +} | ||
3490 | +#endif | ||
3491 | + | ||
3492 | +#ifdef CONFIG_CMD_NAND | ||
3493 | +int board_nand_init(struct nand_chip *nand_chip) | ||
3494 | +{ | ||
3495 | + return zynq_nand_init(nand_chip); | ||
3496 | +} | ||
3497 | +#endif | ||
3498 | + | ||
3499 | int dram_init(void) | ||
3500 | { | ||
3501 | gd->ram_size = CONFIG_SYS_SDRAM_SIZE; | ||
3502 | diff --git a/boards.cfg b/boards.cfg | ||
3503 | index e4b0d44..f75a139 100644 | ||
3504 | --- a/boards.cfg | ||
3505 | +++ b/boards.cfg | ||
3506 | @@ -278,6 +278,16 @@ twister arm armv7 twister technex | ||
3507 | nokia_rx51 arm armv7 rx51 nokia omap3 | ||
3508 | omap4_panda arm armv7 panda ti omap4 | ||
3509 | omap4_sdp4430 arm armv7 sdp4430 ti omap4 | ||
3510 | +zynq_zc770_XM010 arm armv7 zynq xilinx zynq zynq_zc770:ZC770_XM010 | ||
3511 | +zynq_zc770_XM011 arm armv7 zynq xilinx zynq zynq_zc770:ZC770_XM011 | ||
3512 | +zynq_zc770_XM012 arm armv7 zynq xilinx zynq zynq_zc770:ZC770_XM012 | ||
3513 | +zynq_zc770_XM013 arm armv7 zynq xilinx zynq zynq_zc770:ZC770_XM013 | ||
3514 | +zynq_afx_nor arm armv7 zynq xilinx zynq zynq_afx:AFX_NOR | ||
3515 | +zynq_afx_qspi arm armv7 zynq xilinx zynq zynq_afx:AFX_QSPI | ||
3516 | +zynq_afx_nand arm armv7 zynq xilinx zynq zynq_afx:AFX_NAND | ||
3517 | +zynq_zc70x arm armv7 zynq xilinx zynq | ||
3518 | +zynq_cseflash arm armv7 zynq xilinx zynq | ||
3519 | +zynq_zed arm armv7 zynq xilinx zynq | ||
3520 | omap5_evm arm armv7 omap5_evm ti omap5 | ||
3521 | s5p_goni arm armv7 goni samsung s5pc1xx | ||
3522 | smdkc100 arm armv7 smdkc100 samsung s5pc1xx | ||
3523 | @@ -295,7 +305,6 @@ u8500_href arm armv7 u8500 st-eric | ||
3524 | snowball arm armv7 snowball st-ericsson u8500 | ||
3525 | kzm9g arm armv7 kzm9g kmc rmobile | ||
3526 | armadillo-800eva arm armv7 armadillo-800eva atmark-techno rmobile | ||
3527 | -zynq arm armv7 zynq xilinx zynq | ||
3528 | socfpga_cyclone5 arm armv7 socfpga_cyclone5 altera socfpga | ||
3529 | actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2 | ||
3530 | actux1_4_32 arm ixp actux1 - - actux1:FLASH2X2,RAM_32MB | ||
3531 | @@ -1014,10 +1023,6 @@ walnut powerpc ppc4xx walnut amcc | ||
3532 | yellowstone powerpc ppc4xx yosemite amcc - yosemite:YELLOWSTONE | ||
3533 | yosemite powerpc ppc4xx yosemite amcc - yosemite:YOSEMITE | ||
3534 | yucca powerpc ppc4xx - amcc | ||
3535 | -fx12mm powerpc ppc4xx fx12mm avnet - fx12mm:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,INIT_TLB=board/xilinx/ppc405-generic/init.o | ||
3536 | -fx12mm_flash powerpc ppc4xx fx12mm avnet - fx12mm:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc405-generic/init.o | ||
3537 | -v5fx30teval powerpc ppc4xx v5fx30teval avnet - v5fx30teval:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,BOOT_FROM_XMD=1,INIT_TLB=board/xilinx/ppc440-generic/init.o | ||
3538 | -v5fx30teval_flash powerpc ppc4xx v5fx30teval avnet - v5fx30teval:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc440-generic/init.o | ||
3539 | CRAYL1 powerpc ppc4xx L1 cray | ||
3540 | CATcenter powerpc ppc4xx PPChameleonEVB dave - CATcenter:PPCHAMELEON_MODULE_MODEL=1 | ||
3541 | CATcenter_25 powerpc ppc4xx PPChameleonEVB dave - CATcenter:PPCHAMELEON_MODULE_MODEL=1,PPCHAMELEON_CLK_25 | ||
3542 | @@ -1072,12 +1077,8 @@ p3p440 powerpc ppc4xx - prodriv | ||
3543 | KAREF powerpc ppc4xx karef sandburst | ||
3544 | METROBOX powerpc ppc4xx metrobox sandburst | ||
3545 | xpedite1000 powerpc ppc4xx - xes | ||
3546 | -ml507 powerpc ppc4xx ml507 xilinx - ml507:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,BOOT_FROM_XMD=1,INIT_TLB=board/xilinx/ppc440-generic/init.o | ||
3547 | -ml507_flash powerpc ppc4xx ml507 xilinx - ml507:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc440-generic/init.o | ||
3548 | -xilinx-ppc405-generic powerpc ppc4xx ppc405-generic xilinx - xilinx-ppc405-generic:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000 | ||
3549 | -xilinx-ppc405-generic_flash powerpc ppc4xx ppc405-generic xilinx - xilinx-ppc405-generic:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC | ||
3550 | -xilinx-ppc440-generic powerpc ppc4xx ppc440-generic xilinx - xilinx-ppc440-generic:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,BOOT_FROM_XMD=1 | ||
3551 | -xilinx-ppc440-generic_flash powerpc ppc4xx ppc440-generic xilinx - xilinx-ppc440-generic:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC | ||
3552 | +xilinx-ppc405-generic powerpc ppc4xx ppc405-generic xilinx - | ||
3553 | +xilinx-ppc440-generic powerpc ppc4xx ppc440-generic xilinx - | ||
3554 | sandbox sandbox sandbox sandbox sandbox - | ||
3555 | rsk7203 sh sh2 rsk7203 renesas - | ||
3556 | rsk7264 sh sh2 rsk7264 renesas - | ||
3557 | -- | ||
3558 | 1.7.5.4 | ||
3559 | |||
diff --git a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0003-Xilinx-modifications-to-commmon.patch b/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0003-Xilinx-modifications-to-commmon.patch deleted file mode 100644 index 0b1dc671..00000000 --- a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0003-Xilinx-modifications-to-commmon.patch +++ /dev/null | |||
@@ -1,522 +0,0 @@ | |||
1 | From cc18c64aaa0a3cfb82ca490fe7e7e7d1a554b739 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sipke Vriend <sipke.vriend@xilinx.com> | ||
3 | Date: Tue, 21 May 2013 07:19:12 +1000 | ||
4 | Subject: [PATCH 3/5] Xilinx modifications to commmon | ||
5 | |||
6 | Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> | ||
7 | --- | ||
8 | Makefile | 2 +- | ||
9 | common/Makefile | 1 - | ||
10 | common/cmd_bdinfo.c | 27 +++- | ||
11 | common/cmd_mfsl.c | 404 --------------------------------------------------- | ||
12 | common/stdio.c | 2 +- | ||
13 | 5 files changed, 24 insertions(+), 412 deletions(-) | ||
14 | mode change 100644 => 100755 Makefile | ||
15 | delete mode 100644 common/cmd_mfsl.c | ||
16 | |||
17 | diff --git a/Makefile b/Makefile | ||
18 | old mode 100644 | ||
19 | new mode 100755 | ||
20 | index 8dd09a5..3305e8c | ||
21 | --- a/Makefile | ||
22 | +++ b/Makefile | ||
23 | @@ -23,7 +23,7 @@ | ||
24 | |||
25 | VERSION = 2013 | ||
26 | PATCHLEVEL = 01 | ||
27 | -SUBLEVEL = 01 | ||
28 | +SUBLEVEL = | ||
29 | EXTRAVERSION = | ||
30 | ifneq "$(SUBLEVEL)" "" | ||
31 | U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | ||
32 | diff --git a/common/Makefile b/common/Makefile | ||
33 | index 54fcc81..45c7afc 100644 | ||
34 | --- a/common/Makefile | ||
35 | +++ b/common/Makefile | ||
36 | @@ -125,7 +125,6 @@ COBJS-$(CONFIG_ID_EEPROM) += cmd_mac.o | ||
37 | COBJS-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o | ||
38 | COBJS-$(CONFIG_CMD_MEMORY) += cmd_mem.o | ||
39 | COBJS-$(CONFIG_CMD_IO) += cmd_io.o | ||
40 | -COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o | ||
41 | COBJS-$(CONFIG_MII) += miiphyutil.o | ||
42 | COBJS-$(CONFIG_CMD_MII) += miiphyutil.o | ||
43 | COBJS-$(CONFIG_PHYLIB) += miiphyutil.o | ||
44 | diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c | ||
45 | index 48cdd16..28b5241 100644 | ||
46 | --- a/common/cmd_bdinfo.c | ||
47 | +++ b/common/cmd_bdinfo.c | ||
48 | @@ -51,6 +51,25 @@ static void print_eth(int idx) | ||
49 | } | ||
50 | |||
51 | __maybe_unused | ||
52 | +static void print_eths(void) | ||
53 | +{ | ||
54 | + struct eth_device *dev; | ||
55 | + int i = 0; | ||
56 | + | ||
57 | + do { | ||
58 | + dev = eth_get_dev_by_index(i); | ||
59 | + if (dev) { | ||
60 | + printf("eth%dname = %s\n", i, dev->name); | ||
61 | + print_eth(i); | ||
62 | + i++; | ||
63 | + } | ||
64 | + } while (dev); | ||
65 | + | ||
66 | + printf("current eth = %s\n", eth_get_name()); | ||
67 | + printf("ip_addr = %s\n", getenv("ipaddr")); | ||
68 | +} | ||
69 | + | ||
70 | +__maybe_unused | ||
71 | static void print_lnum(const char *name, unsigned long long value) | ||
72 | { | ||
73 | printf("%-12s= 0x%.8llX\n", name, value); | ||
74 | @@ -195,10 +214,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
75 | print_num("sram size ", (ulong)bd->bi_sramsize); | ||
76 | #endif | ||
77 | #if defined(CONFIG_CMD_NET) | ||
78 | - print_eth(0); | ||
79 | - printf("ip_addr = %s\n", getenv("ipaddr")); | ||
80 | + print_eths(); | ||
81 | #endif | ||
82 | - printf("baudrate = %u bps\n", (ulong)bd->bi_baudrate); | ||
83 | + printf("baudrate = %u bps\n", bd->bi_baudrate); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | @@ -366,8 +384,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | ||
88 | } | ||
89 | |||
90 | #if defined(CONFIG_CMD_NET) | ||
91 | - print_eth(0); | ||
92 | - printf("ip_addr = %s\n", getenv("ipaddr")); | ||
93 | + print_eths(); | ||
94 | #endif | ||
95 | printf("baudrate = %u bps\n", bd->bi_baudrate); | ||
96 | #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) | ||
97 | diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c | ||
98 | deleted file mode 100644 | ||
99 | index ddf80d7..0000000 | ||
100 | --- a/common/cmd_mfsl.c | ||
101 | +++ /dev/null | ||
102 | @@ -1,404 +0,0 @@ | ||
103 | -/* | ||
104 | - * (C) Copyright 2007 Michal Simek | ||
105 | - * | ||
106 | - * Michal SIMEK <monstr@monstr.eu> | ||
107 | - * | ||
108 | - * See file CREDITS for list of people who contributed to this | ||
109 | - * project. | ||
110 | - * | ||
111 | - * This program is free software; you can redistribute it and/or | ||
112 | - * modify it under the terms of the GNU General Public License as | ||
113 | - * published by the Free Software Foundation; either version 2 of | ||
114 | - * the License, or (at your option) any later version. | ||
115 | - * | ||
116 | - * This program is distributed in the hope that it will be useful, | ||
117 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
118 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
119 | - * GNU General Public License for more details. | ||
120 | - * | ||
121 | - * You should have received a copy of the GNU General Public License | ||
122 | - * along with this program; if not, write to the Free Software | ||
123 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
124 | - * MA 02111-1307 USA | ||
125 | - */ | ||
126 | - | ||
127 | -/* | ||
128 | - * Microblaze FSL support | ||
129 | - */ | ||
130 | - | ||
131 | -#include <common.h> | ||
132 | -#include <config.h> | ||
133 | -#include <command.h> | ||
134 | -#include <asm/asm.h> | ||
135 | - | ||
136 | -int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) | ||
137 | -{ | ||
138 | - unsigned int fslnum; | ||
139 | - unsigned int num; | ||
140 | - unsigned int blocking; | ||
141 | - | ||
142 | - if (argc < 2) | ||
143 | - return CMD_RET_USAGE; | ||
144 | - | ||
145 | - fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); | ||
146 | - blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16); | ||
147 | - if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) { | ||
148 | - puts ("Bad number of FSL\n"); | ||
149 | - return CMD_RET_USAGE; | ||
150 | - } | ||
151 | - | ||
152 | - switch (fslnum) { | ||
153 | -#if (XILINX_FSL_NUMBER > 0) | ||
154 | - case 0: | ||
155 | - switch (blocking) { | ||
156 | - case 0: NGET (num, 0); | ||
157 | - break; | ||
158 | - case 1: NCGET (num, 0); | ||
159 | - break; | ||
160 | - case 2: GET (num, 0); | ||
161 | - break; | ||
162 | - case 3: CGET (num, 0); | ||
163 | - break; | ||
164 | - default: | ||
165 | - return 2; | ||
166 | - } | ||
167 | - break; | ||
168 | -#endif | ||
169 | -#if (XILINX_FSL_NUMBER > 1) | ||
170 | - case 1: | ||
171 | - switch (blocking) { | ||
172 | - case 0: NGET (num, 1); | ||
173 | - break; | ||
174 | - case 1: NCGET (num, 1); | ||
175 | - break; | ||
176 | - case 2: GET (num, 1); | ||
177 | - break; | ||
178 | - case 3: CGET (num, 1); | ||
179 | - break; | ||
180 | - default: | ||
181 | - return 2; | ||
182 | - } | ||
183 | - break; | ||
184 | -#endif | ||
185 | -#if (XILINX_FSL_NUMBER > 2) | ||
186 | - case 2: | ||
187 | - switch (blocking) { | ||
188 | - case 0: NGET (num, 2); | ||
189 | - break; | ||
190 | - case 1: NCGET (num, 2); | ||
191 | - break; | ||
192 | - case 2: GET (num, 2); | ||
193 | - break; | ||
194 | - case 3: CGET (num, 2); | ||
195 | - break; | ||
196 | - default: | ||
197 | - return 2; | ||
198 | - } | ||
199 | - break; | ||
200 | -#endif | ||
201 | -#if (XILINX_FSL_NUMBER > 3) | ||
202 | - case 3: | ||
203 | - switch (blocking) { | ||
204 | - case 0: NGET (num, 3); | ||
205 | - break; | ||
206 | - case 1: NCGET (num, 3); | ||
207 | - break; | ||
208 | - case 2: GET (num, 3); | ||
209 | - break; | ||
210 | - case 3: CGET (num, 3); | ||
211 | - break; | ||
212 | - default: | ||
213 | - return 2; | ||
214 | - } | ||
215 | - break; | ||
216 | -#endif | ||
217 | -#if (XILINX_FSL_NUMBER > 4) | ||
218 | - case 4: | ||
219 | - switch (blocking) { | ||
220 | - case 0: NGET (num, 4); | ||
221 | - break; | ||
222 | - case 1: NCGET (num, 4); | ||
223 | - break; | ||
224 | - case 2: GET (num, 4); | ||
225 | - break; | ||
226 | - case 3: CGET (num, 4); | ||
227 | - break; | ||
228 | - default: | ||
229 | - return 2; | ||
230 | - } | ||
231 | - break; | ||
232 | -#endif | ||
233 | -#if (XILINX_FSL_NUMBER > 5) | ||
234 | - case 5: | ||
235 | - switch (blocking) { | ||
236 | - case 0: NGET (num, 5); | ||
237 | - break; | ||
238 | - case 1: NCGET (num, 5); | ||
239 | - break; | ||
240 | - case 2: GET (num, 5); | ||
241 | - break; | ||
242 | - case 3: CGET (num, 5); | ||
243 | - break; | ||
244 | - default: | ||
245 | - return 2; | ||
246 | - } | ||
247 | - break; | ||
248 | -#endif | ||
249 | -#if (XILINX_FSL_NUMBER > 6) | ||
250 | - case 6: | ||
251 | - switch (blocking) { | ||
252 | - case 0: NGET (num, 6); | ||
253 | - break; | ||
254 | - case 1: NCGET (num, 6); | ||
255 | - break; | ||
256 | - case 2: GET (num, 6); | ||
257 | - break; | ||
258 | - case 3: CGET (num, 6); | ||
259 | - break; | ||
260 | - default: | ||
261 | - return 2; | ||
262 | - } | ||
263 | - break; | ||
264 | -#endif | ||
265 | -#if (XILINX_FSL_NUMBER > 7) | ||
266 | - case 7: | ||
267 | - switch (blocking) { | ||
268 | - case 0: NGET (num, 7); | ||
269 | - break; | ||
270 | - case 1: NCGET (num, 7); | ||
271 | - break; | ||
272 | - case 2: GET (num, 7); | ||
273 | - break; | ||
274 | - case 3: CGET (num, 7); | ||
275 | - break; | ||
276 | - default: | ||
277 | - return 2; | ||
278 | - } | ||
279 | - break; | ||
280 | -#endif | ||
281 | - default: | ||
282 | - return 1; | ||
283 | - } | ||
284 | - | ||
285 | - printf ("%01x: 0x%08x - %s %s read\n", fslnum, num, | ||
286 | - blocking < 2 ? "non blocking" : "blocking", | ||
287 | - ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); | ||
288 | - return 0; | ||
289 | -} | ||
290 | - | ||
291 | -int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) | ||
292 | -{ | ||
293 | - unsigned int fslnum; | ||
294 | - unsigned int num; | ||
295 | - unsigned int blocking; | ||
296 | - | ||
297 | - if (argc < 3) | ||
298 | - return CMD_RET_USAGE; | ||
299 | - | ||
300 | - fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); | ||
301 | - num = (unsigned int)simple_strtoul (argv[2], NULL, 16); | ||
302 | - blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16); | ||
303 | - if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) | ||
304 | - return CMD_RET_USAGE; | ||
305 | - | ||
306 | - switch (fslnum) { | ||
307 | -#if (XILINX_FSL_NUMBER > 0) | ||
308 | - case 0: | ||
309 | - switch (blocking) { | ||
310 | - case 0: NPUT (num, 0); | ||
311 | - break; | ||
312 | - case 1: NCPUT (num, 0); | ||
313 | - break; | ||
314 | - case 2: PUT (num, 0); | ||
315 | - break; | ||
316 | - case 3: CPUT (num, 0); | ||
317 | - break; | ||
318 | - default: | ||
319 | - return 2; | ||
320 | - } | ||
321 | - break; | ||
322 | -#endif | ||
323 | -#if (XILINX_FSL_NUMBER > 1) | ||
324 | - case 1: | ||
325 | - switch (blocking) { | ||
326 | - case 0: NPUT (num, 1); | ||
327 | - break; | ||
328 | - case 1: NCPUT (num, 1); | ||
329 | - break; | ||
330 | - case 2: PUT (num, 1); | ||
331 | - break; | ||
332 | - case 3: CPUT (num, 1); | ||
333 | - break; | ||
334 | - default: | ||
335 | - return 2; | ||
336 | - } | ||
337 | - break; | ||
338 | -#endif | ||
339 | -#if (XILINX_FSL_NUMBER > 2) | ||
340 | - case 2: | ||
341 | - switch (blocking) { | ||
342 | - case 0: NPUT (num, 2); | ||
343 | - break; | ||
344 | - case 1: NCPUT (num, 2); | ||
345 | - break; | ||
346 | - case 2: PUT (num, 2); | ||
347 | - break; | ||
348 | - case 3: CPUT (num, 2); | ||
349 | - break; | ||
350 | - default: | ||
351 | - return 2; | ||
352 | - } | ||
353 | - break; | ||
354 | -#endif | ||
355 | -#if (XILINX_FSL_NUMBER > 3) | ||
356 | - case 3: | ||
357 | - switch (blocking) { | ||
358 | - case 0: NPUT (num, 3); | ||
359 | - break; | ||
360 | - case 1: NCPUT (num, 3); | ||
361 | - break; | ||
362 | - case 2: PUT (num, 3); | ||
363 | - break; | ||
364 | - case 3: CPUT (num, 3); | ||
365 | - break; | ||
366 | - default: | ||
367 | - return 2; | ||
368 | - } | ||
369 | - break; | ||
370 | -#endif | ||
371 | -#if (XILINX_FSL_NUMBER > 4) | ||
372 | - case 4: | ||
373 | - switch (blocking) { | ||
374 | - case 0: NPUT (num, 4); | ||
375 | - break; | ||
376 | - case 1: NCPUT (num, 4); | ||
377 | - break; | ||
378 | - case 2: PUT (num, 4); | ||
379 | - break; | ||
380 | - case 3: CPUT (num, 4); | ||
381 | - break; | ||
382 | - default: | ||
383 | - return 2; | ||
384 | - } | ||
385 | - break; | ||
386 | -#endif | ||
387 | -#if (XILINX_FSL_NUMBER > 5) | ||
388 | - case 5: | ||
389 | - switch (blocking) { | ||
390 | - case 0: NPUT (num, 5); | ||
391 | - break; | ||
392 | - case 1: NCPUT (num, 5); | ||
393 | - break; | ||
394 | - case 2: PUT (num, 5); | ||
395 | - break; | ||
396 | - case 3: CPUT (num, 5); | ||
397 | - break; | ||
398 | - default: | ||
399 | - return 2; | ||
400 | - } | ||
401 | - break; | ||
402 | -#endif | ||
403 | -#if (XILINX_FSL_NUMBER > 6) | ||
404 | - case 6: | ||
405 | - switch (blocking) { | ||
406 | - case 0: NPUT (num, 6); | ||
407 | - break; | ||
408 | - case 1: NCPUT (num, 6); | ||
409 | - break; | ||
410 | - case 2: PUT (num, 6); | ||
411 | - break; | ||
412 | - case 3: CPUT (num, 6); | ||
413 | - break; | ||
414 | - default: | ||
415 | - return 2; | ||
416 | - } | ||
417 | - break; | ||
418 | -#endif | ||
419 | -#if (XILINX_FSL_NUMBER > 7) | ||
420 | - case 7: | ||
421 | - switch (blocking) { | ||
422 | - case 0: NPUT (num, 7); | ||
423 | - break; | ||
424 | - case 1: NCPUT (num, 7); | ||
425 | - break; | ||
426 | - case 2: PUT (num, 7); | ||
427 | - break; | ||
428 | - case 3: CPUT (num, 7); | ||
429 | - break; | ||
430 | - default: | ||
431 | - return 2; | ||
432 | - } | ||
433 | - break; | ||
434 | -#endif | ||
435 | - default: | ||
436 | - return 1; | ||
437 | - } | ||
438 | - | ||
439 | - printf ("%01x: 0x%08x - %s %s write\n", fslnum, num, | ||
440 | - blocking < 2 ? "non blocking" : "blocking", | ||
441 | - ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); | ||
442 | - return 0; | ||
443 | - | ||
444 | -} | ||
445 | - | ||
446 | -int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) | ||
447 | -{ | ||
448 | - unsigned int reg = 0; | ||
449 | - unsigned int val = 0; | ||
450 | - | ||
451 | - if (argc < 2) | ||
452 | - return CMD_RET_USAGE; | ||
453 | - | ||
454 | - reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); | ||
455 | - val = (unsigned int)simple_strtoul (argv[2], NULL, 16); | ||
456 | - switch (reg) { | ||
457 | - case 0x1: | ||
458 | - if (argc > 2) { | ||
459 | - MTS (val, rmsr); | ||
460 | - NOP; | ||
461 | - MFS (val, rmsr); | ||
462 | - } else { | ||
463 | - MFS (val, rmsr); | ||
464 | - } | ||
465 | - puts ("MSR"); | ||
466 | - break; | ||
467 | - case 0x3: | ||
468 | - MFS (val, rear); | ||
469 | - puts ("EAR"); | ||
470 | - break; | ||
471 | - case 0x5: | ||
472 | - MFS (val, resr); | ||
473 | - puts ("ESR"); | ||
474 | - break; | ||
475 | - default: | ||
476 | - puts ("Unsupported register\n"); | ||
477 | - return 1; | ||
478 | - } | ||
479 | - printf (": 0x%08x\n", val); | ||
480 | - return 0; | ||
481 | -} | ||
482 | - | ||
483 | -/***************************************************/ | ||
484 | - | ||
485 | -U_BOOT_CMD (frd, 3, 1, do_frd, | ||
486 | - "read data from FSL", | ||
487 | - "- [fslnum [0|1|2|3]]\n" | ||
488 | - " 0 - non blocking data read\n" | ||
489 | - " 1 - non blocking control read\n" | ||
490 | - " 2 - blocking data read\n" | ||
491 | - " 3 - blocking control read"); | ||
492 | - | ||
493 | -U_BOOT_CMD (fwr, 4, 1, do_fwr, | ||
494 | - "write data to FSL", | ||
495 | - "- [fslnum [0|1|2|3]]\n" | ||
496 | - " 0 - non blocking data write\n" | ||
497 | - " 1 - non blocking control write\n" | ||
498 | - " 2 - blocking data write\n" | ||
499 | - " 3 - blocking control write"); | ||
500 | - | ||
501 | -U_BOOT_CMD (rspr, 3, 1, do_rspr, | ||
502 | - "read/write special purpose register", | ||
503 | - "- reg_num [write value] read/write special purpose register\n" | ||
504 | - " 1 - MSR - Machine status register\n" | ||
505 | - " 3 - EAR - Exception address register\n" | ||
506 | - " 5 - ESR - Exception status register"); | ||
507 | diff --git a/common/stdio.c b/common/stdio.c | ||
508 | index 97ff9cf..5d5117c 100644 | ||
509 | --- a/common/stdio.c | ||
510 | +++ b/common/stdio.c | ||
511 | @@ -207,7 +207,7 @@ int stdio_init (void) | ||
512 | /* Initialize the list */ | ||
513 | INIT_LIST_HEAD(&(devs.list)); | ||
514 | |||
515 | -#ifdef CONFIG_ARM_DCC_MULTI | ||
516 | +#ifdef CONFIG_ARM_DCC | ||
517 | drv_arm_dcc_init (); | ||
518 | #endif | ||
519 | #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) | ||
520 | -- | ||
521 | 1.7.5.4 | ||
522 | |||
diff --git a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0004-Xilinx-modifications-to-drivers.patch b/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0004-Xilinx-modifications-to-drivers.patch deleted file mode 100644 index 08a001e6..00000000 --- a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0004-Xilinx-modifications-to-drivers.patch +++ /dev/null | |||
@@ -1,7367 +0,0 @@ | |||
1 | From bc707e15987263fe5db08a452fe373401c7c359f Mon Sep 17 00:00:00 2001 | ||
2 | From: Sipke Vriend <sipke.vriend@xilinx.com> | ||
3 | Date: Tue, 21 May 2013 07:19:13 +1000 | ||
4 | Subject: [PATCH 4/5] Xilinx modifications to drivers | ||
5 | |||
6 | Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> | ||
7 | --- | ||
8 | doc/README.watchdog | 3 + | ||
9 | drivers/block/systemace.c | 4 +- | ||
10 | drivers/fpga/Makefile | 1 + | ||
11 | drivers/fpga/xilinx.c | 35 + | ||
12 | drivers/fpga/zynqpl.c | 193 ++++++ | ||
13 | drivers/i2c/Makefile | 1 + | ||
14 | drivers/i2c/zynq_i2c.c | 303 +++++++++ | ||
15 | drivers/mmc/Makefile | 1 + | ||
16 | drivers/mmc/zynq_sdhci.c | 40 ++ | ||
17 | drivers/mtd/nand/Makefile | 1 + | ||
18 | drivers/mtd/nand/nand_base.c | 5 + | ||
19 | drivers/mtd/nand/zynq_nand.c | 1240 ++++++++++++++++++++++++++++++++++ | ||
20 | drivers/mtd/spi/spansion.c | 18 +- | ||
21 | drivers/mtd/spi/spi_flash.c | 172 +++++- | ||
22 | drivers/mtd/spi/spi_flash_internal.h | 19 + | ||
23 | drivers/mtd/spi/stmicro.c | 40 ++- | ||
24 | drivers/mtd/spi/winbond.c | 15 +- | ||
25 | drivers/net/Makefile | 3 +- | ||
26 | drivers/net/phy/marvell.c | 11 + | ||
27 | drivers/net/xilinx_axi_emac.c | 124 +++- | ||
28 | drivers/net/xilinx_emaclite.c | 281 +++++++- | ||
29 | drivers/net/xilinx_ll_temac.c | 885 +++++++++++++++++-------- | ||
30 | drivers/net/xilinx_ll_temac.h | 310 --------- | ||
31 | drivers/net/xilinx_ll_temac_fifo.c | 142 ---- | ||
32 | drivers/net/xilinx_ll_temac_fifo.h | 121 ---- | ||
33 | drivers/net/xilinx_ll_temac_mdio.c | 180 ----- | ||
34 | drivers/net/xilinx_ll_temac_mdio.h | 53 -- | ||
35 | drivers/net/xilinx_ll_temac_sdma.c | 369 ---------- | ||
36 | drivers/net/xilinx_ll_temac_sdma.h | 280 -------- | ||
37 | drivers/net/zynq_gem.c | 251 ++++++-- | ||
38 | drivers/serial/arm_dcc.c | 21 +- | ||
39 | drivers/spi/Makefile | 1 + | ||
40 | drivers/spi/xilinx_spi.c | 2 + | ||
41 | drivers/spi/xilinx_spi.h | 3 + | ||
42 | drivers/spi/zynq_qspips.c | 1056 +++++++++++++++++++++++++++++ | ||
43 | drivers/watchdog/Makefile | 1 + | ||
44 | drivers/watchdog/xilinx_tb_wdt.c | 87 +++ | ||
45 | include/netdev.h | 4 +- | ||
46 | include/spi.h | 2 + | ||
47 | include/spi_flash.h | 2 + | ||
48 | include/stdio_dev.h | 2 +- | ||
49 | include/xilinx.h | 4 + | ||
50 | 42 files changed, 4405 insertions(+), 1881 deletions(-) | ||
51 | create mode 100644 drivers/fpga/zynqpl.c | ||
52 | create mode 100644 drivers/i2c/zynq_i2c.c | ||
53 | create mode 100644 drivers/mmc/zynq_sdhci.c | ||
54 | create mode 100644 drivers/mtd/nand/zynq_nand.c | ||
55 | delete mode 100644 drivers/net/xilinx_ll_temac.h | ||
56 | delete mode 100644 drivers/net/xilinx_ll_temac_fifo.c | ||
57 | delete mode 100644 drivers/net/xilinx_ll_temac_fifo.h | ||
58 | delete mode 100644 drivers/net/xilinx_ll_temac_mdio.c | ||
59 | delete mode 100644 drivers/net/xilinx_ll_temac_mdio.h | ||
60 | delete mode 100644 drivers/net/xilinx_ll_temac_sdma.c | ||
61 | delete mode 100644 drivers/net/xilinx_ll_temac_sdma.h | ||
62 | create mode 100644 drivers/spi/zynq_qspips.c | ||
63 | create mode 100644 drivers/watchdog/xilinx_tb_wdt.c | ||
64 | |||
65 | diff --git a/doc/README.watchdog b/doc/README.watchdog | ||
66 | index ee65008..33f31c2 100644 | ||
67 | --- a/doc/README.watchdog | ||
68 | +++ b/doc/README.watchdog | ||
69 | @@ -27,3 +27,6 @@ CONFIG_IMX_WATCHDOG | ||
70 | Available for i.mx31/35/5x/6x to service the watchdog. This is not | ||
71 | automatically set because some boards (vision2) still need to define | ||
72 | their own hw_watchdog_reset routine. | ||
73 | + | ||
74 | +CONFIG_XILINX_TB_WATCHDOG | ||
75 | + Available for Xilinx Axi platforms to service timebase watchdog timer. | ||
76 | diff --git a/drivers/block/systemace.c b/drivers/block/systemace.c | ||
77 | index 247cf06..b1a3914 100644 | ||
78 | --- a/drivers/block/systemace.c | ||
79 | +++ b/drivers/block/systemace.c | ||
80 | @@ -65,8 +65,8 @@ static void ace_writew(u16 val, unsigned off) | ||
81 | writeb(val, base + off); | ||
82 | writeb(val >> 8, base + off + 1); | ||
83 | #endif | ||
84 | - } | ||
85 | - out16(base + off, val); | ||
86 | + } else | ||
87 | + out16(base + off, val); | ||
88 | } | ||
89 | |||
90 | static u16 ace_readw(unsigned off) | ||
91 | diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile | ||
92 | index b48f623..0b51dcd 100644 | ||
93 | --- a/drivers/fpga/Makefile | ||
94 | +++ b/drivers/fpga/Makefile | ||
95 | @@ -30,6 +30,7 @@ COBJS-y += fpga.o | ||
96 | COBJS-$(CONFIG_FPGA_SPARTAN2) += spartan2.o | ||
97 | COBJS-$(CONFIG_FPGA_SPARTAN3) += spartan3.o | ||
98 | COBJS-$(CONFIG_FPGA_VIRTEX2) += virtex2.o | ||
99 | +COBJS-$(CONFIG_FPGA_ZYNQPL) += zynqpl.o | ||
100 | COBJS-$(CONFIG_FPGA_XILINX) += xilinx.o | ||
101 | COBJS-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o | ||
102 | ifdef CONFIG_FPGA_ALTERA | ||
103 | diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c | ||
104 | index 4072cb4..9ec0263 100644 | ||
105 | --- a/drivers/fpga/xilinx.c | ||
106 | +++ b/drivers/fpga/xilinx.c | ||
107 | @@ -31,6 +31,7 @@ | ||
108 | #include <virtex2.h> | ||
109 | #include <spartan2.h> | ||
110 | #include <spartan3.h> | ||
111 | +#include <zynqpl.h> | ||
112 | |||
113 | #if 0 | ||
114 | #define FPGA_DEBUG | ||
115 | @@ -86,6 +87,16 @@ int xilinx_load(Xilinx_desc *desc, const void *buf, size_t bsize) | ||
116 | __FUNCTION__); | ||
117 | #endif | ||
118 | break; | ||
119 | + case Xilinx_Zynq: | ||
120 | +#if defined(CONFIG_FPGA_ZYNQPL) | ||
121 | + PRINTF("%s: Launching the Zynq PL Loader...\n", | ||
122 | + __func__); | ||
123 | + ret_val = zynq_load(desc, buf, bsize); | ||
124 | +#else | ||
125 | + printf("%s: No support for Zynq devices.\n", | ||
126 | + __func__); | ||
127 | +#endif | ||
128 | + break; | ||
129 | |||
130 | default: | ||
131 | printf ("%s: Unsupported family type, %d\n", | ||
132 | @@ -133,6 +144,16 @@ int xilinx_dump(Xilinx_desc *desc, const void *buf, size_t bsize) | ||
133 | __FUNCTION__); | ||
134 | #endif | ||
135 | break; | ||
136 | + case Xilinx_Zynq: | ||
137 | +#if defined(CONFIG_FPGA_ZYNQPL) | ||
138 | + PRINTF("%s: Launching the Zynq PL Reader...\n", | ||
139 | + __func__); | ||
140 | + ret_val = zynq_dump(desc, buf, bsize); | ||
141 | +#else | ||
142 | + printf("%s: No support for Zynq devices.\n", | ||
143 | + __func__); | ||
144 | +#endif | ||
145 | + break; | ||
146 | |||
147 | default: | ||
148 | printf ("%s: Unsupported family type, %d\n", | ||
149 | @@ -158,6 +179,9 @@ int xilinx_info (Xilinx_desc * desc) | ||
150 | case Xilinx_Virtex2: | ||
151 | printf ("Virtex-II\n"); | ||
152 | break; | ||
153 | + case Xilinx_Zynq: | ||
154 | + printf("Zynq PL\n"); | ||
155 | + break; | ||
156 | /* Add new family types here */ | ||
157 | default: | ||
158 | printf ("Unknown family type, %d\n", desc->family); | ||
159 | @@ -183,6 +207,9 @@ int xilinx_info (Xilinx_desc * desc) | ||
160 | case master_selectmap: | ||
161 | printf ("Master SelectMap Mode\n"); | ||
162 | break; | ||
163 | + case devcfg: | ||
164 | + printf("Device configuration interface (Zynq)\n"); | ||
165 | + break; | ||
166 | /* Add new interface types here */ | ||
167 | default: | ||
168 | printf ("Unsupported interface type, %d\n", desc->iface); | ||
169 | @@ -222,6 +249,14 @@ int xilinx_info (Xilinx_desc * desc) | ||
170 | __FUNCTION__); | ||
171 | #endif | ||
172 | break; | ||
173 | + case Xilinx_Zynq: | ||
174 | +#if defined(CONFIG_FPGA_ZYNQPL) | ||
175 | + zynq_info(desc); | ||
176 | +#else | ||
177 | + /* just in case */ | ||
178 | + printf("%s: No support for Zynq devices.\n", | ||
179 | + __func__); | ||
180 | +#endif | ||
181 | /* Add new family types here */ | ||
182 | default: | ||
183 | /* we don't need a message here - we give one up above */ | ||
184 | diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c | ||
185 | new file mode 100644 | ||
186 | index 0000000..17cccf9 | ||
187 | --- /dev/null | ||
188 | +++ b/drivers/fpga/zynqpl.c | ||
189 | @@ -0,0 +1,193 @@ | ||
190 | +/* | ||
191 | + * (C) Copyright 2012 | ||
192 | + * Joe Hershberger <joe.hershberger@ni.com> | ||
193 | + * | ||
194 | + * See file CREDITS for list of people who contributed to this | ||
195 | + * project. | ||
196 | + * | ||
197 | + * This program is free software; you can redistribute it and/or | ||
198 | + * modify it under the terms of the GNU General Public License as | ||
199 | + * published by the Free Software Foundation; either version 2 of | ||
200 | + * the License, or (at your option) any later version. | ||
201 | + * | ||
202 | + * This program is distributed in the hope that it will be useful, | ||
203 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
204 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
205 | + * GNU General Public License for more details. | ||
206 | + * | ||
207 | + * You should have received a copy of the GNU General Public License | ||
208 | + * along with this program; if not, write to the Free Software | ||
209 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
210 | + * MA 02111-1307 USA | ||
211 | + * | ||
212 | + */ | ||
213 | + | ||
214 | +#include <common.h> | ||
215 | +#include <asm/io.h> | ||
216 | +#include <zynqpl.h> | ||
217 | +#include <asm/arch/hardware.h> | ||
218 | +#include <asm/arch/sys_proto.h> | ||
219 | + | ||
220 | +#define DEVCFG_CTRL_PCFG_PROG_B 0x40000000 | ||
221 | +#define DEVCFG_ISR_FATAL_ERROR_MASK 0x00740040 | ||
222 | +#define DEVCFG_ISR_ERROR_FLAGS_MASK 0x00340840 | ||
223 | +#define DEVCFG_ISR_RX_FIFO_OV 0x00040000 | ||
224 | +#define DEVCFG_ISR_DMA_DONE 0x00002000 | ||
225 | +#define DEVCFG_ISR_PCFG_DONE 0x00000004 | ||
226 | +#define DEVCFG_STATUS_DMA_CMD_Q_F 0x80000000 | ||
227 | +#define DEVCFG_STATUS_DMA_CMD_Q_E 0x40000000 | ||
228 | +#define DEVCFG_STATUS_DMA_DONE_CNT_MASK 0x30000000 | ||
229 | +#define DEVCFG_STATUS_PCFG_INIT 0x00000010 | ||
230 | +#define DEVCFG_MCTRL_RFIFO_FLUSH 0x00000002 | ||
231 | +#define DEVCFG_MCTRL_WFIFO_FLUSH 0x00000001 | ||
232 | + | ||
233 | +#ifndef CONFIG_SYS_FPGA_WAIT | ||
234 | +#define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/100 /* 10 ms */ | ||
235 | +#endif | ||
236 | + | ||
237 | +#ifndef CONFIG_SYS_FPGA_PROG_TIME | ||
238 | +#define CONFIG_SYS_FPGA_PROG_TIME CONFIG_SYS_HZ /* 1 s */ | ||
239 | +#endif | ||
240 | + | ||
241 | +int zynq_info(Xilinx_desc *desc) | ||
242 | +{ | ||
243 | + return FPGA_SUCCESS; | ||
244 | +} | ||
245 | + | ||
246 | +int zynq_load(Xilinx_desc *desc, const void *buf, size_t bsize) | ||
247 | +{ | ||
248 | + unsigned long ts; /* Timestamp */ | ||
249 | + u32 control; | ||
250 | + u32 isr_status; | ||
251 | + u32 status; | ||
252 | + | ||
253 | + /* FIXME Add checking that passing bin is not a bitstream */ | ||
254 | + | ||
255 | + zynq_slcr_devcfg_disable(); | ||
256 | + | ||
257 | + /* Setting PCFG_PROG_B signal to high */ | ||
258 | + control = readl(&devcfg_base->ctrl); | ||
259 | + writel(control | DEVCFG_CTRL_PCFG_PROG_B, &devcfg_base->ctrl); | ||
260 | + /* Setting PCFG_PROG_B signal to low */ | ||
261 | + writel(control & ~DEVCFG_CTRL_PCFG_PROG_B, &devcfg_base->ctrl); | ||
262 | + | ||
263 | + /* Polling the PCAP_INIT status for Reset */ | ||
264 | + ts = get_timer(0); | ||
265 | + while (readl(&devcfg_base->status) & DEVCFG_STATUS_PCFG_INIT) { | ||
266 | + if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { | ||
267 | + puts("Error: Timeout waiting for INIT to clear.\n"); | ||
268 | + return FPGA_FAIL; | ||
269 | + } | ||
270 | + } | ||
271 | + | ||
272 | + /* Setting PCFG_PROG_B signal to high */ | ||
273 | + writel(control | DEVCFG_CTRL_PCFG_PROG_B, &devcfg_base->ctrl); | ||
274 | + | ||
275 | + /* Polling the PCAP_INIT status for Set */ | ||
276 | + ts = get_timer(0); | ||
277 | + while (!(readl(&devcfg_base->status) & DEVCFG_STATUS_PCFG_INIT)) { | ||
278 | + if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { | ||
279 | + puts("Error: Timeout waiting for INIT to set.\n"); | ||
280 | + return FPGA_FAIL; | ||
281 | + } | ||
282 | + } | ||
283 | + | ||
284 | + isr_status = readl(&devcfg_base->int_sts); | ||
285 | + | ||
286 | + /* Clear it all, so if Boot ROM comes back, it can proceed */ | ||
287 | + writel(0xFFFFFFFF, &devcfg_base->int_sts); | ||
288 | + | ||
289 | + if (isr_status & DEVCFG_ISR_FATAL_ERROR_MASK) { | ||
290 | + debug("Fatal errors in PCAP 0x%X\n", isr_status); | ||
291 | + | ||
292 | + /* If RX FIFO overflow, need to flush RX FIFO first */ | ||
293 | + if (isr_status & DEVCFG_ISR_RX_FIFO_OV) { | ||
294 | + writel(DEVCFG_MCTRL_RFIFO_FLUSH, &devcfg_base->mctrl); | ||
295 | + writel(0xFFFFFFFF, &devcfg_base->int_sts); | ||
296 | + } | ||
297 | + return FPGA_FAIL; | ||
298 | + } | ||
299 | + | ||
300 | + status = readl(&devcfg_base->status); | ||
301 | + | ||
302 | + debug("status = 0x%08X\n", status); | ||
303 | + | ||
304 | + if (status & DEVCFG_STATUS_DMA_CMD_Q_F) { | ||
305 | + debug("Error: device busy\n"); | ||
306 | + return FPGA_FAIL; | ||
307 | + } | ||
308 | + | ||
309 | + debug("device ready\n"); | ||
310 | + | ||
311 | + if (!(status & DEVCFG_STATUS_DMA_CMD_Q_E)) { | ||
312 | + if (!(readl(&devcfg_base->int_sts) & DEVCFG_ISR_DMA_DONE)) { | ||
313 | + /* Error state, transfer cannot occur */ | ||
314 | + debug("isr indicates error\n"); | ||
315 | + return FPGA_FAIL; | ||
316 | + } else { | ||
317 | + /* Clear out the status */ | ||
318 | + writel(DEVCFG_ISR_DMA_DONE, &devcfg_base->int_sts); | ||
319 | + } | ||
320 | + } | ||
321 | + | ||
322 | + if (status & DEVCFG_STATUS_DMA_DONE_CNT_MASK) { | ||
323 | + /* Clear the count of completed DMA transfers */ | ||
324 | + writel(DEVCFG_STATUS_DMA_DONE_CNT_MASK, &devcfg_base->status); | ||
325 | + } | ||
326 | + | ||
327 | + debug("Source = 0x%08X\n", (u32)buf); | ||
328 | + debug("Size = %zu\n", bsize); | ||
329 | + | ||
330 | + /* Set up the transfer */ | ||
331 | + writel((u32)buf | 1, &devcfg_base->dma_src_addr); | ||
332 | + writel(0xFFFFFFFF, &devcfg_base->dma_dst_addr); | ||
333 | + writel(bsize >> 2, &devcfg_base->dma_src_len); | ||
334 | + writel(0, &devcfg_base->dma_dst_len); | ||
335 | + | ||
336 | + isr_status = readl(&devcfg_base->int_sts); | ||
337 | + | ||
338 | + /* Polling the PCAP_INIT status for Set */ | ||
339 | + ts = get_timer(0); | ||
340 | + while (!(isr_status & DEVCFG_ISR_DMA_DONE)) { | ||
341 | + if (isr_status & DEVCFG_ISR_ERROR_FLAGS_MASK) { | ||
342 | + debug("Error: isr = 0x%08X\n", isr_status); | ||
343 | + debug("Write count = 0x%08X\n", | ||
344 | + readl(&devcfg_base->write_count)); | ||
345 | + debug("Read count = 0x%08X\n", | ||
346 | + readl(&devcfg_base->read_count)); | ||
347 | + | ||
348 | + return FPGA_FAIL; | ||
349 | + } | ||
350 | + if (get_timer(ts) > CONFIG_SYS_FPGA_PROG_TIME) { | ||
351 | + puts("Error: Timeout waiting for DMA to complete.\n"); | ||
352 | + return FPGA_FAIL; | ||
353 | + } | ||
354 | + isr_status = readl(&devcfg_base->int_sts); | ||
355 | + } | ||
356 | + | ||
357 | + debug("DMA transfer is done\n"); | ||
358 | + | ||
359 | + /* Check FPGA configuration completion */ | ||
360 | + ts = get_timer(0); | ||
361 | + while (!(isr_status & DEVCFG_ISR_PCFG_DONE)) { | ||
362 | + if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { | ||
363 | + puts("Error: Timeout waiting for FPGA to config.\n"); | ||
364 | + return FPGA_FAIL; | ||
365 | + } | ||
366 | + isr_status = readl(&devcfg_base->int_sts); | ||
367 | + } | ||
368 | + | ||
369 | + debug("FPGA config done\n"); | ||
370 | + | ||
371 | + /* Clear out the DMA status */ | ||
372 | + writel(DEVCFG_ISR_DMA_DONE, &devcfg_base->int_sts); | ||
373 | + | ||
374 | + zynq_slcr_devcfg_enable(); | ||
375 | + | ||
376 | + return FPGA_SUCCESS; | ||
377 | +} | ||
378 | + | ||
379 | +int zynq_dump(Xilinx_desc *desc, const void *buf, size_t bsize) | ||
380 | +{ | ||
381 | + return FPGA_FAIL; | ||
382 | +} | ||
383 | diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile | ||
384 | index 5dbdbe3..72e85a3 100644 | ||
385 | --- a/drivers/i2c/Makefile | ||
386 | +++ b/drivers/i2c/Makefile | ||
387 | @@ -46,6 +46,7 @@ COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o | ||
388 | COBJS-$(CONFIG_U8500_I2C) += u8500_i2c.o | ||
389 | COBJS-$(CONFIG_SH_I2C) += sh_i2c.o | ||
390 | COBJS-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o | ||
391 | +COBJS-$(CONFIG_ZYNQ_I2C) += zynq_i2c.o | ||
392 | |||
393 | COBJS := $(COBJS-y) | ||
394 | SRCS := $(COBJS:.o=.c) | ||
395 | diff --git a/drivers/i2c/zynq_i2c.c b/drivers/i2c/zynq_i2c.c | ||
396 | new file mode 100644 | ||
397 | index 0000000..14ca163 | ||
398 | --- /dev/null | ||
399 | +++ b/drivers/i2c/zynq_i2c.c | ||
400 | @@ -0,0 +1,303 @@ | ||
401 | +/* | ||
402 | + * Driver for the Zynq-7000 PSS I2C controller | ||
403 | + * IP from Cadence (ID T-CS-PE-0007-100, Version R1p10f2) | ||
404 | + * | ||
405 | + * Author: Joe Hershberger <joe.hershberger@ni.com> | ||
406 | + * Copyright (c) 2012 Joe Hershberger. | ||
407 | + * | ||
408 | + * See file CREDITS for list of people who contributed to this | ||
409 | + * project. | ||
410 | + * | ||
411 | + * This program is free software; you can redistribute it and/or | ||
412 | + * modify it under the terms of the GNU General Public License as | ||
413 | + * published by the Free Software Foundation; either version 2 of | ||
414 | + * the License, or (at your option) any later version. | ||
415 | + * | ||
416 | + * This program is distributed in the hope that it will be useful, | ||
417 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
418 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
419 | + * GNU General Public License for more details. | ||
420 | + * | ||
421 | + * You should have received a copy of the GNU General Public License | ||
422 | + * along with this program; if not, write to the Free Software | ||
423 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
424 | + * MA 02110-1301 USA | ||
425 | + */ | ||
426 | + | ||
427 | +#include <common.h> | ||
428 | +#include <asm/io.h> | ||
429 | +#include <i2c.h> | ||
430 | +#include <asm/errno.h> | ||
431 | + | ||
432 | +/* i2c register set */ | ||
433 | +struct zynq_i2c_registers { | ||
434 | + u32 control; | ||
435 | + u32 status; | ||
436 | + u32 address; | ||
437 | + u32 data; | ||
438 | + u32 interrupt_status; | ||
439 | + u32 transfer_size; | ||
440 | + u32 slave_mon_pause; | ||
441 | + u32 time_out; | ||
442 | + u32 interrupt_mask; | ||
443 | + u32 interrupt_enable; | ||
444 | + u32 interrupt_disable; | ||
445 | +}; | ||
446 | + | ||
447 | +/* Control register fields */ | ||
448 | +#define ZYNQ_I2C_CONTROL_RW 0x00000001 | ||
449 | +#define ZYNQ_I2C_CONTROL_MS 0x00000002 | ||
450 | +#define ZYNQ_I2C_CONTROL_NEA 0x00000004 | ||
451 | +#define ZYNQ_I2C_CONTROL_ACKEN 0x00000008 | ||
452 | +#define ZYNQ_I2C_CONTROL_HOLD 0x00000010 | ||
453 | +#define ZYNQ_I2C_CONTROL_SLVMON 0x00000020 | ||
454 | +#define ZYNQ_I2C_CONTROL_CLR_FIFO 0x00000040 | ||
455 | +#define ZYNQ_I2C_CONTROL_DIV_B_SHIFT 8 | ||
456 | +#define ZYNQ_I2C_CONTROL_DIV_B_MASK 0x00003F00 | ||
457 | +#define ZYNQ_I2C_CONTROL_DIV_A_SHIFT 14 | ||
458 | +#define ZYNQ_I2C_CONTROL_DIV_A_MASK 0x0000C000 | ||
459 | + | ||
460 | +/* Status register values */ | ||
461 | +#define ZYNQ_I2C_STATUS_RXDV 0x00000020 | ||
462 | +#define ZYNQ_I2C_STATUS_TXDV 0x00000040 | ||
463 | +#define ZYNQ_I2C_STATUS_RXOVF 0x00000080 | ||
464 | +#define ZYNQ_I2C_STATUS_BA 0x00000100 | ||
465 | + | ||
466 | +/* Interrupt register fields */ | ||
467 | +#define ZYNQ_I2C_INTERRUPT_COMP 0x00000001 | ||
468 | +#define ZYNQ_I2C_INTERRUPT_DATA 0x00000002 | ||
469 | +#define ZYNQ_I2C_INTERRUPT_NACK 0x00000004 | ||
470 | +#define ZYNQ_I2C_INTERRUPT_TO 0x00000008 | ||
471 | +#define ZYNQ_I2C_INTERRUPT_SLVRDY 0x00000010 | ||
472 | +#define ZYNQ_I2C_INTERRUPT_RXOVF 0x00000020 | ||
473 | +#define ZYNQ_I2C_INTERRUPT_TXOVF 0x00000040 | ||
474 | +#define ZYNQ_I2C_INTERRUPT_RXUNF 0x00000080 | ||
475 | +#define ZYNQ_I2C_INTERRUPT_ARBLOST 0x00000200 | ||
476 | + | ||
477 | +#if defined(CONFIG_ZYNQ_I2C_CTLR_0) | ||
478 | +#define ZYNQ_I2C_BASE 0xE0004000 | ||
479 | +#if defined(CONFIG_ZYNQ_I2C_CTLR_1) | ||
480 | +#warning Only CONFIG_ZYNQ_I2C_CTLR_0 will be accessible | ||
481 | +#endif | ||
482 | +#elif defined(CONFIG_ZYNQ_I2C_CTLR_1) | ||
483 | +#define ZYNQ_I2C_BASE 0xE0005000 | ||
484 | +#else | ||
485 | +#error You must select CONFIG_ZYNQ_I2C_CTLR_0 or CONFIG_ZYNQ_I2C_CTLR_1 | ||
486 | +#endif | ||
487 | + | ||
488 | +#define ZYNQ_I2C_FIFO_DEPTH 16 | ||
489 | +#define ZYNQ_I2C_TRANSFERT_SIZE_MAX 255 /* Controller transfer limit */ | ||
490 | + | ||
491 | +static struct zynq_i2c_registers *zynq_i2c = | ||
492 | + (struct zynq_i2c_registers *) ZYNQ_I2C_BASE; | ||
493 | + | ||
494 | +/* I2C init called by cmd_i2c when doing 'i2c reset'. */ | ||
495 | +void i2c_init(int requested_speed, int slaveadd) | ||
496 | +{ | ||
497 | + /* 111MHz / ( (3 * 17) * 22 ) = ~100KHz */ | ||
498 | + writel((16 << ZYNQ_I2C_CONTROL_DIV_B_SHIFT) | | ||
499 | + (2 << ZYNQ_I2C_CONTROL_DIV_A_SHIFT), &zynq_i2c->control); | ||
500 | + | ||
501 | + /* Enable master mode, ack, and 7-bit addressing */ | ||
502 | + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_MS | | ||
503 | + ZYNQ_I2C_CONTROL_ACKEN | ZYNQ_I2C_CONTROL_NEA); | ||
504 | +} | ||
505 | + | ||
506 | +#ifdef DEBUG | ||
507 | +static void zynq_i2c_debug_status(void) | ||
508 | +{ | ||
509 | + int int_status; | ||
510 | + int status; | ||
511 | + int_status = readl(&zynq_i2c->interrupt_status); | ||
512 | + status = readl(&zynq_i2c->status); | ||
513 | + if (int_status || status) { | ||
514 | + debug("Status: "); | ||
515 | + if (int_status & ZYNQ_I2C_INTERRUPT_COMP) | ||
516 | + debug("COMP "); | ||
517 | + if (int_status & ZYNQ_I2C_INTERRUPT_DATA) | ||
518 | + debug("DATA "); | ||
519 | + if (int_status & ZYNQ_I2C_INTERRUPT_NACK) | ||
520 | + debug("NACK "); | ||
521 | + if (int_status & ZYNQ_I2C_INTERRUPT_TO) | ||
522 | + debug("TO "); | ||
523 | + if (int_status & ZYNQ_I2C_INTERRUPT_SLVRDY) | ||
524 | + debug("SLVRDY "); | ||
525 | + if (int_status & ZYNQ_I2C_INTERRUPT_RXOVF) | ||
526 | + debug("RXOVF "); | ||
527 | + if (int_status & ZYNQ_I2C_INTERRUPT_TXOVF) | ||
528 | + debug("TXOVF "); | ||
529 | + if (int_status & ZYNQ_I2C_INTERRUPT_RXUNF) | ||
530 | + debug("RXUNF "); | ||
531 | + if (int_status & ZYNQ_I2C_INTERRUPT_ARBLOST) | ||
532 | + debug("ARBLOST "); | ||
533 | + if (status & ZYNQ_I2C_STATUS_RXDV) | ||
534 | + debug("RXDV "); | ||
535 | + if (status & ZYNQ_I2C_STATUS_TXDV) | ||
536 | + debug("TXDV "); | ||
537 | + if (status & ZYNQ_I2C_STATUS_RXOVF) | ||
538 | + debug("RXOVF "); | ||
539 | + if (status & ZYNQ_I2C_STATUS_BA) | ||
540 | + debug("BA "); | ||
541 | + debug("TS%d ", readl(&zynq_i2c->transfer_size)); | ||
542 | + debug("\n"); | ||
543 | + } | ||
544 | +} | ||
545 | +#endif | ||
546 | + | ||
547 | +/* Wait for an interrupt */ | ||
548 | +static u32 zynq_i2c_wait(u32 mask) | ||
549 | +{ | ||
550 | + int timeout, int_status; | ||
551 | + for (timeout = 0; timeout < 100; timeout++) { | ||
552 | + udelay(100); | ||
553 | + int_status = readl(&zynq_i2c->interrupt_status); | ||
554 | + if (int_status & mask) | ||
555 | + break; | ||
556 | + } | ||
557 | +#ifdef DEBUG | ||
558 | + zynq_i2c_debug_status(); | ||
559 | +#endif | ||
560 | + /* Clear interrupt status flags */ | ||
561 | + writel(int_status & mask, &zynq_i2c->interrupt_status); | ||
562 | + return int_status & mask; | ||
563 | +} | ||
564 | + | ||
565 | +/* | ||
566 | + * I2C probe called by cmd_i2c when doing 'i2c probe'. | ||
567 | + * Begin read, nak data byte, end. | ||
568 | + */ | ||
569 | +int i2c_probe(u8 dev) | ||
570 | +{ | ||
571 | + /* Attempt to read a byte */ | ||
572 | + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_CLR_FIFO | | ||
573 | + ZYNQ_I2C_CONTROL_RW); | ||
574 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
575 | + writel(0xFF, &zynq_i2c->interrupt_status); | ||
576 | + writel(dev, &zynq_i2c->address); | ||
577 | + writel(1, &zynq_i2c->transfer_size); | ||
578 | + | ||
579 | + return (zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP | | ||
580 | + ZYNQ_I2C_INTERRUPT_NACK) & | ||
581 | + ZYNQ_I2C_INTERRUPT_COMP) ? 0 : -ETIMEDOUT; | ||
582 | +} | ||
583 | + | ||
584 | +/* | ||
585 | + * I2C read called by cmd_i2c when doing 'i2c read' and by cmd_eeprom.c | ||
586 | + * Begin write, send address byte(s), begin read, receive data bytes, end. | ||
587 | + */ | ||
588 | +int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length) | ||
589 | +{ | ||
590 | + u32 status; | ||
591 | + u32 i = 0; | ||
592 | + u8 *cur_data = data; | ||
593 | + | ||
594 | + /* check the hardware can handle the requested bytes */ | ||
595 | + if ((length < 0) || (length > ZYNQ_I2C_TRANSFERT_SIZE_MAX)) | ||
596 | + return -EINVAL; | ||
597 | + | ||
598 | + /* Write the register address */ | ||
599 | + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_CLR_FIFO | | ||
600 | + ZYNQ_I2C_CONTROL_HOLD); | ||
601 | + /* Temporarily disable restart (by clearing hold)... */ | ||
602 | + /* It doesn't seem to work. */ | ||
603 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_RW | | ||
604 | + ZYNQ_I2C_CONTROL_HOLD); | ||
605 | + writel(0xFF, &zynq_i2c->interrupt_status); | ||
606 | + while (alen--) | ||
607 | + writel(addr >> (8*alen), &zynq_i2c->data); | ||
608 | + writel(dev, &zynq_i2c->address); | ||
609 | + | ||
610 | + /* wait for the address to be sent */ | ||
611 | + if (!zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP)) { | ||
612 | + /* Release the bus */ | ||
613 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
614 | + return -ETIMEDOUT; | ||
615 | + } | ||
616 | + debug("Device acked address\n"); | ||
617 | + | ||
618 | + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_CLR_FIFO | | ||
619 | + ZYNQ_I2C_CONTROL_RW); | ||
620 | + /* Start reading data */ | ||
621 | + writel(dev, &zynq_i2c->address); | ||
622 | + writel(length, &zynq_i2c->transfer_size); | ||
623 | + | ||
624 | + /* wait for data */ | ||
625 | + do { | ||
626 | + status = zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP | | ||
627 | + ZYNQ_I2C_INTERRUPT_DATA); | ||
628 | + if (!status) { | ||
629 | + /* Release the bus */ | ||
630 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
631 | + return -ETIMEDOUT; | ||
632 | + } | ||
633 | + debug("Read %d bytes\n", | ||
634 | + length - readl(&zynq_i2c->transfer_size)); | ||
635 | + for (; i < length - readl(&zynq_i2c->transfer_size); i++) | ||
636 | + *(cur_data++) = readl(&zynq_i2c->data); | ||
637 | + } while (readl(&zynq_i2c->transfer_size) != 0); | ||
638 | + /* All done... release the bus */ | ||
639 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
640 | + | ||
641 | +#ifdef DEBUG | ||
642 | + zynq_i2c_debug_status(); | ||
643 | +#endif | ||
644 | + return 0; | ||
645 | +} | ||
646 | + | ||
647 | +/* | ||
648 | + * I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c | ||
649 | + * Begin write, send address byte(s), send data bytes, end. | ||
650 | + */ | ||
651 | +int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length) | ||
652 | +{ | ||
653 | + u8 *cur_data = data; | ||
654 | + | ||
655 | + /* Write the register address */ | ||
656 | + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_CLR_FIFO | | ||
657 | + ZYNQ_I2C_CONTROL_HOLD); | ||
658 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_RW); | ||
659 | + writel(0xFF, &zynq_i2c->interrupt_status); | ||
660 | + while (alen--) | ||
661 | + writel(addr >> (8*alen), &zynq_i2c->data); | ||
662 | + /* Start the tranfer */ | ||
663 | + writel(dev, &zynq_i2c->address); | ||
664 | + if (!zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP)) { | ||
665 | + /* Release the bus */ | ||
666 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
667 | + return -ETIMEDOUT; | ||
668 | + } | ||
669 | + | ||
670 | + debug("Device acked address\n"); | ||
671 | + while (length--) { | ||
672 | + writel(*(cur_data++), &zynq_i2c->data); | ||
673 | + if (readl(&zynq_i2c->transfer_size) == ZYNQ_I2C_FIFO_DEPTH) { | ||
674 | + if (!zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP)) { | ||
675 | + /* Release the bus */ | ||
676 | + clrbits_le32(&zynq_i2c->control, | ||
677 | + ZYNQ_I2C_CONTROL_HOLD); | ||
678 | + return -ETIMEDOUT; | ||
679 | + } | ||
680 | + } | ||
681 | + } | ||
682 | + | ||
683 | + /* All done... release the bus */ | ||
684 | + clrbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_HOLD); | ||
685 | + /* wait for the address and data to be sent */ | ||
686 | + if (!zynq_i2c_wait(ZYNQ_I2C_INTERRUPT_COMP)) | ||
687 | + return -ETIMEDOUT; | ||
688 | + return 0; | ||
689 | +} | ||
690 | + | ||
691 | +int i2c_set_bus_num(unsigned int bus) | ||
692 | +{ | ||
693 | + /* Only support bus 0 */ | ||
694 | + if (bus > 0) | ||
695 | + return -1; | ||
696 | + return 0; | ||
697 | +} | ||
698 | + | ||
699 | +unsigned int i2c_get_bus_num(void) | ||
700 | +{ | ||
701 | + /* Only support bus 0 */ | ||
702 | + return 0; | ||
703 | +} | ||
704 | diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile | ||
705 | index 65791aa..692a2f7 100644 | ||
706 | --- a/drivers/mmc/Makefile | ||
707 | +++ b/drivers/mmc/Makefile | ||
708 | @@ -48,6 +48,7 @@ COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o | ||
709 | COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o | ||
710 | COBJS-$(CONFIG_DWMMC) += dw_mmc.o | ||
711 | COBJS-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o | ||
712 | +COBJS-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o | ||
713 | |||
714 | COBJS := $(COBJS-y) | ||
715 | SRCS := $(COBJS:.o=.c) | ||
716 | diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c | ||
717 | new file mode 100644 | ||
718 | index 0000000..340c098 | ||
719 | --- /dev/null | ||
720 | +++ b/drivers/mmc/zynq_sdhci.c | ||
721 | @@ -0,0 +1,40 @@ | ||
722 | +/* | ||
723 | + * (C) Copyright 2013 Inc. | ||
724 | + * | ||
725 | + * Xilinx Zynq SD Host Controller Interface | ||
726 | + * | ||
727 | + * This program is free software; you can redistribute it and/or modify it under | ||
728 | + * the terms of the GNU General Public License version 2 as published by the | ||
729 | + * Free Software Foundation; either version 2 of the License, or (at your | ||
730 | + * option) any later version. | ||
731 | + * | ||
732 | + * You should have received a copy of the GNU General Public License along with | ||
733 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
734 | + * Place, Suite 330, Boston, MA 02111-1307 USA | ||
735 | + */ | ||
736 | + | ||
737 | +#include <common.h> | ||
738 | +#include <malloc.h> | ||
739 | +#include <sdhci.h> | ||
740 | +#include <asm/arch/mmc.h> | ||
741 | + | ||
742 | +int zynq_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk) | ||
743 | +{ | ||
744 | + struct sdhci_host *host = NULL; | ||
745 | + | ||
746 | + host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host)); | ||
747 | + if (!host) { | ||
748 | + printf("zynq_sdhci_init: sdhci_host malloc fail\n"); | ||
749 | + return 1; | ||
750 | + } | ||
751 | + | ||
752 | + host->name = "zynq_sdhci"; | ||
753 | + host->ioaddr = (void *) regbase; | ||
754 | + host->quirks = SDHCI_QUIRK_NO_CD | SDHCI_QUIRK_WAIT_SEND_CMD; | ||
755 | + host->version = sdhci_readw(host, SDHCI_HOST_VERSION); | ||
756 | + | ||
757 | + host->host_caps = MMC_MODE_HC; | ||
758 | + | ||
759 | + add_sdhci(host, max_clk, min_clk); | ||
760 | + return 0; | ||
761 | +} | ||
762 | diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile | ||
763 | index c77c0c4..76d7168 100644 | ||
764 | --- a/drivers/mtd/nand/Makefile | ||
765 | +++ b/drivers/mtd/nand/Makefile | ||
766 | @@ -78,6 +78,7 @@ COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o | ||
767 | COBJS-$(CONFIG_TEGRA_NAND) += tegra_nand.o | ||
768 | COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o | ||
769 | COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o | ||
770 | +COBJS-$(CONFIG_NAND_ZYNQ) += zynq_nand.o | ||
771 | |||
772 | else # minimal SPL drivers | ||
773 | |||
774 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c | ||
775 | index a2d06be..280e8f2 100644 | ||
776 | --- a/drivers/mtd/nand/nand_base.c | ||
777 | +++ b/drivers/mtd/nand/nand_base.c | ||
778 | @@ -786,13 +786,18 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) | ||
779 | return 0x01; | ||
780 | } | ||
781 | |||
782 | +/* HACK FIXME BHILL */ | ||
783 | +#ifndef CONFIG_ZYNQ | ||
784 | if (chip->dev_ready) { | ||
785 | if (chip->dev_ready(mtd)) | ||
786 | break; | ||
787 | } else { | ||
788 | +#endif | ||
789 | if (chip->read_byte(mtd) & NAND_STATUS_READY) | ||
790 | break; | ||
791 | +#ifndef CONFIG_ZYNQ | ||
792 | } | ||
793 | +#endif | ||
794 | } | ||
795 | #ifdef PPCHAMELON_NAND_TIMER_HACK | ||
796 | time_start = get_timer(0); | ||
797 | diff --git a/drivers/mtd/nand/zynq_nand.c b/drivers/mtd/nand/zynq_nand.c | ||
798 | new file mode 100644 | ||
799 | index 0000000..7ab5909 | ||
800 | --- /dev/null | ||
801 | +++ b/drivers/mtd/nand/zynq_nand.c | ||
802 | @@ -0,0 +1,1240 @@ | ||
803 | +/* | ||
804 | + * Xilinx PS NAND Flash Controller Driver | ||
805 | + * This driver is based on plat_nand.c and mxc_nand.c drivers | ||
806 | + * | ||
807 | + * Copyright (C) 2009 Xilinx, Inc. | ||
808 | + * | ||
809 | + * This program is free software; you can redistribute it and/or modify it under | ||
810 | + * the terms of the GNU General Public License version 2 as published by the | ||
811 | + * Free Software Foundation; either version 2 of the License, or (at your | ||
812 | + * option) any later version. | ||
813 | + * | ||
814 | + * You should have received a copy of the GNU General Public License along with | ||
815 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
816 | + * Place, Suite 330, Boston, MA 02111-1307 USA | ||
817 | + */ | ||
818 | + | ||
819 | +#include <common.h> | ||
820 | +#include <malloc.h> | ||
821 | +#include <asm/arch/nand.h> | ||
822 | +#include <asm/io.h> | ||
823 | +#include <linux/mtd/mtd.h> | ||
824 | +#include <linux/mtd/nand.h> | ||
825 | +#include <linux/mtd/partitions.h> | ||
826 | +#include <linux/mtd/nand_ecc.h> | ||
827 | +#include <asm/arch/sys_proto.h> | ||
828 | + | ||
829 | +/* The NAND flash driver defines */ | ||
830 | +#define XNANDPS_CMD_PHASE 1 /* End command valid in command phase */ | ||
831 | +#define XNANDPS_DATA_PHASE 2 /* End command valid in data phase */ | ||
832 | +#define XNANDPS_ECC_SIZE 512 /* Size of data for ECC operation */ | ||
833 | + | ||
834 | +/* Flash memory controller operating parameters */ | ||
835 | +#define XNANDPS_CLR_CONFIG ((0x1 << 1) | /* Disable interrupt */ \ | ||
836 | + (0x1 << 4) | /* Clear interrupt */ \ | ||
837 | + (0x1 << 6)) /* Disable ECC interrupt */ | ||
838 | + | ||
839 | +/* Assuming 50MHz clock (20ns cycle time) and 3V operation */ | ||
840 | +#define XNANDPS_SET_CYCLES ((0x2 << 20) | /* t_rr from nand_cycles */ \ | ||
841 | + (0x2 << 17) | /* t_ar from nand_cycles */ \ | ||
842 | + (0x1 << 14) | /* t_clr from nand_cycles */ \ | ||
843 | + (0x3 << 11) | /* t_wp from nand_cycles */ \ | ||
844 | + (0x2 << 8) | /* t_rea from nand_cycles */ \ | ||
845 | + (0x5 << 4) | /* t_wc from nand_cycles */ \ | ||
846 | + (0x5 << 0)) /* t_rc from nand_cycles */ | ||
847 | + | ||
848 | +#define XNANDPS_SET_OPMODE 0x0 | ||
849 | + | ||
850 | +#define XNANDPS_DIRECT_CMD ((0x4 << 23) | /* Chip 0 from interface 1 */ \ | ||
851 | + (0x2 << 21)) /* UpdateRegs operation */ | ||
852 | + | ||
853 | +#define XNANDPS_ECC_CONFIG ((0x1 << 2) | /* ECC available on APB */ \ | ||
854 | + (0x1 << 4) | /* ECC read at end of page */ \ | ||
855 | + (0x0 << 5)) /* No Jumping */ | ||
856 | + | ||
857 | +#define XNANDPS_ECC_CMD1 ((0x80) | /* Write command */ \ | ||
858 | + (0x00 << 8) | /* Read command */ \ | ||
859 | + (0x30 << 16) | /* Read End command */ \ | ||
860 | + (0x1 << 24)) /* Read End command calid */ | ||
861 | + | ||
862 | +#define XNANDPS_ECC_CMD2 ((0x85) | /* Write col change cmd */ \ | ||
863 | + (0x05 << 8) | /* Read col change cmd */ \ | ||
864 | + (0xE0 << 16) | /* Read col change end cmd */ \ | ||
865 | + (0x1 << 24)) /* Read col change | ||
866 | + end cmd valid */ | ||
867 | +/* AXI Address definitions */ | ||
868 | +#define START_CMD_SHIFT 3 | ||
869 | +#define END_CMD_SHIFT 11 | ||
870 | +#define END_CMD_VALID_SHIFT 20 | ||
871 | +#define ADDR_CYCLES_SHIFT 21 | ||
872 | +#define CLEAR_CS_SHIFT 21 | ||
873 | +#define ECC_LAST_SHIFT 10 | ||
874 | +#define COMMAND_PHASE (0 << 19) | ||
875 | +#define DATA_PHASE (1 << 19) | ||
876 | + | ||
877 | +#define XNANDPS_ECC_LAST (1 << ECC_LAST_SHIFT) /* Set ECC_Last */ | ||
878 | +#define XNANDPS_CLEAR_CS (1 << CLEAR_CS_SHIFT) /* Clear chip select */ | ||
879 | + | ||
880 | +/* ECC block registers bit position and bit mask */ | ||
881 | +#define XNANDPS_ECC_BUSY (1 << 6) /* ECC block is busy */ | ||
882 | +#define XNANDPS_ECC_MASK 0x00FFFFFF /* ECC value mask */ | ||
883 | + | ||
884 | +/* NAND MIO buswidth count*/ | ||
885 | +#define XNANDPS_MIO_NUM_NAND_8BIT 13 | ||
886 | +#define XNANDPS_MIO_NUM_NAND_16BIT 8 | ||
887 | + | ||
888 | +/* NAND buswidth */ | ||
889 | +enum xnandps_bus_width { | ||
890 | + NAND_BW_UNKNOWN = -1, | ||
891 | + NAND_BW_8BIT, | ||
892 | + NAND_BW_16BIT, | ||
893 | +}; | ||
894 | + | ||
895 | +/* SMC register set */ | ||
896 | +struct xnandps_smc_regs { | ||
897 | + u32 csr; /* 0x00 */ | ||
898 | + u32 reserved0[2]; | ||
899 | + u32 cfr; /* 0x0C */ | ||
900 | + u32 dcr; /* 0x10 */ | ||
901 | + u32 scr; /* 0x14 */ | ||
902 | + u32 sor; /* 0x18 */ | ||
903 | + u32 reserved1[249]; | ||
904 | + u32 esr; /* 0x400 */ | ||
905 | + u32 emcr; /* 0x404 */ | ||
906 | + u32 emcmd1r; /* 0x408 */ | ||
907 | + u32 emcmd2r; /* 0x40C */ | ||
908 | + u32 reserved2[2]; | ||
909 | + u32 eval0r; /* 0x418 */ | ||
910 | +}; | ||
911 | + | ||
912 | +#define xnandps_smc_base \ | ||
913 | + ((struct xnandps_smc_regs *) XPSS_CRTL_PARPORT_BASEADDR) | ||
914 | + | ||
915 | +/* | ||
916 | + * struct xnandps_command_format - Defines NAND flash command format | ||
917 | + * @start_cmd: First cycle command (Start command) | ||
918 | + * @end_cmd: Second cycle command (Last command) | ||
919 | + * @addr_cycles: Number of address cycles required to send the address | ||
920 | + * @end_cmd_valid: The second cycle command is valid for cmd or data phase | ||
921 | + */ | ||
922 | +struct xnandps_command_format { | ||
923 | + int start_cmd; | ||
924 | + int end_cmd; | ||
925 | + u8 addr_cycles; | ||
926 | + u8 end_cmd_valid; | ||
927 | +}; | ||
928 | + | ||
929 | +/* | ||
930 | + * struct xnandps_info - Defines the NAND flash driver instance | ||
931 | + * @parts: Pointer to the mtd_partition structure | ||
932 | + * @nand_base: Virtual address of the NAND flash device | ||
933 | + * @end_cmd_pending: End command is pending | ||
934 | + * @end_cmd: End command | ||
935 | + */ | ||
936 | +struct xnandps_info { | ||
937 | +#ifdef CONFIG_MTD_PARTITIONS | ||
938 | + struct mtd_partition *parts; | ||
939 | +#endif | ||
940 | + void __iomem *nand_base; | ||
941 | + unsigned long end_cmd_pending; | ||
942 | + unsigned long end_cmd; | ||
943 | +}; | ||
944 | + | ||
945 | +#define NAND_CMD_GET_FEATURES 0xEE | ||
946 | +#define NAND_CMD_SET_FEATURES 0xEF | ||
947 | +#define ONDIE_ECC_FEATURE_ADDR 0x90 | ||
948 | + | ||
949 | +/* The NAND flash operations command format */ | ||
950 | +static const struct xnandps_command_format xnandps_commands[] = { | ||
951 | + {NAND_CMD_READ0, NAND_CMD_READSTART, 5, XNANDPS_CMD_PHASE}, | ||
952 | + {NAND_CMD_RNDOUT, NAND_CMD_RNDOUTSTART, 2, XNANDPS_CMD_PHASE}, | ||
953 | + {NAND_CMD_READID, NAND_CMD_NONE, 1, NAND_CMD_NONE}, | ||
954 | + {NAND_CMD_STATUS, NAND_CMD_NONE, 0, NAND_CMD_NONE}, | ||
955 | + {NAND_CMD_SEQIN, NAND_CMD_PAGEPROG, 5, XNANDPS_DATA_PHASE}, | ||
956 | + {NAND_CMD_RNDIN, NAND_CMD_NONE, 2, NAND_CMD_NONE}, | ||
957 | + {NAND_CMD_ERASE1, NAND_CMD_ERASE2, 3, XNANDPS_CMD_PHASE}, | ||
958 | + {NAND_CMD_RESET, NAND_CMD_NONE, 0, NAND_CMD_NONE}, | ||
959 | + {NAND_CMD_PARAM, NAND_CMD_NONE, 1, NAND_CMD_NONE}, | ||
960 | + {NAND_CMD_GET_FEATURES, NAND_CMD_NONE, 1, NAND_CMD_NONE}, | ||
961 | + {NAND_CMD_SET_FEATURES, NAND_CMD_NONE, 1, NAND_CMD_NONE}, | ||
962 | + {NAND_CMD_NONE, NAND_CMD_NONE, 0, 0}, | ||
963 | + /* Add all the flash commands supported by the flash device and Linux | ||
964 | + * The cache program command is not supported by driver because driver | ||
965 | + * cant differentiate between page program and cached page program from | ||
966 | + * start command, these commands can be differentiated through end | ||
967 | + * command, which doesn't fit in to the driver design. The cache program | ||
968 | + * command is not supported by NAND subsystem also, look at 1612 line | ||
969 | + * number (in nand_write_page function) of nand_base.c file. | ||
970 | + * {NAND_CMD_SEQIN, NAND_CMD_CACHEDPROG, 5, XNANDPS_YES} | ||
971 | + */ | ||
972 | +}; | ||
973 | + | ||
974 | +/* Define default oob placement schemes for large and small page devices */ | ||
975 | +static struct nand_ecclayout nand_oob_16 = { | ||
976 | + .eccbytes = 3, | ||
977 | + .eccpos = {13, 14, 15}, | ||
978 | + .oobfree = { | ||
979 | + {.offset = 0, | ||
980 | + . length = 12} } | ||
981 | +}; | ||
982 | + | ||
983 | +static struct nand_ecclayout nand_oob_64 = { | ||
984 | + .eccbytes = 12, | ||
985 | + .eccpos = { | ||
986 | + 52, 53, 54, 55, 56, 57, | ||
987 | + 58, 59, 60, 61, 62, 63}, | ||
988 | + .oobfree = { | ||
989 | + {.offset = 2, | ||
990 | + .length = 50} } | ||
991 | +}; | ||
992 | + | ||
993 | +static struct nand_ecclayout ondie_nand_oob_64 = { | ||
994 | + .eccbytes = 32, | ||
995 | + | ||
996 | + .eccpos = { | ||
997 | + 8, 9, 10, 11, 12, 13, 14, 15, | ||
998 | + 24, 25, 26, 27, 28, 29, 30, 31, | ||
999 | + 40, 41, 42, 43, 44, 45, 46, 47, | ||
1000 | + 56, 57, 58, 59, 60, 61, 62, 63 | ||
1001 | + }, | ||
1002 | + | ||
1003 | + .oobfree = { | ||
1004 | + { .offset = 4, .length = 4 }, | ||
1005 | + { .offset = 20, .length = 4 }, | ||
1006 | + { .offset = 36, .length = 4 }, | ||
1007 | + { .offset = 52, .length = 4 } | ||
1008 | + } | ||
1009 | +}; | ||
1010 | + | ||
1011 | +/* Generic flash bbt decriptors */ | ||
1012 | +static uint8_t bbt_pattern[] = {'B', 'b', 't', '0' }; | ||
1013 | +static uint8_t mirror_pattern[] = {'1', 't', 'b', 'B' }; | ||
1014 | + | ||
1015 | +static struct nand_bbt_descr bbt_main_descr = { | ||
1016 | + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||
1017 | + NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, | ||
1018 | + .offs = 4, | ||
1019 | + .len = 4, | ||
1020 | + .veroffs = 20, | ||
1021 | + .maxblocks = 4, | ||
1022 | + .pattern = bbt_pattern | ||
1023 | +}; | ||
1024 | + | ||
1025 | +static struct nand_bbt_descr bbt_mirror_descr = { | ||
1026 | + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||
1027 | + NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, | ||
1028 | + .offs = 4, | ||
1029 | + .len = 4, | ||
1030 | + .veroffs = 20, | ||
1031 | + .maxblocks = 4, | ||
1032 | + .pattern = mirror_pattern | ||
1033 | +}; | ||
1034 | + | ||
1035 | +/* | ||
1036 | + * xnandps_waitfor_ecc_completion - Wait for ECC completion | ||
1037 | + * | ||
1038 | + * returns: status for command completion, -1 for Timeout | ||
1039 | + */ | ||
1040 | +static int xnandps_waitfor_ecc_completion(void) | ||
1041 | +{ | ||
1042 | + unsigned long timeout; | ||
1043 | + u32 status; | ||
1044 | + | ||
1045 | + /* Wait max 10ms */ | ||
1046 | + timeout = 10; | ||
1047 | + status = readl(&xnandps_smc_base->esr); | ||
1048 | + while (status & XNANDPS_ECC_BUSY) { | ||
1049 | + status = readl(&xnandps_smc_base->esr); | ||
1050 | + if (timeout == 0) | ||
1051 | + return -1; | ||
1052 | + timeout--; | ||
1053 | + udelay(1); | ||
1054 | + } | ||
1055 | + | ||
1056 | + return status; | ||
1057 | +} | ||
1058 | + | ||
1059 | +/* | ||
1060 | + * xnandps_init_nand_flash - Initialize NAND controller | ||
1061 | + * @option: Device property flags | ||
1062 | + * | ||
1063 | + * This function initializes the NAND flash interface on the NAND controller. | ||
1064 | + * | ||
1065 | + * returns: 0 on success or error value on failure | ||
1066 | + */ | ||
1067 | +static int xnandps_init_nand_flash(int option) | ||
1068 | +{ | ||
1069 | + u32 status; | ||
1070 | + | ||
1071 | + /* disable interrupts */ | ||
1072 | + writel(XNANDPS_CLR_CONFIG, &xnandps_smc_base->cfr); | ||
1073 | + /* Initialize the NAND interface by setting cycles and operation mode */ | ||
1074 | + writel(XNANDPS_SET_CYCLES, &xnandps_smc_base->scr); | ||
1075 | + if (option & NAND_BUSWIDTH_16) | ||
1076 | + writel((XNANDPS_SET_OPMODE | 0x1), &xnandps_smc_base->sor); | ||
1077 | + else | ||
1078 | + writel(XNANDPS_SET_OPMODE, &xnandps_smc_base->sor); | ||
1079 | + | ||
1080 | + writel(XNANDPS_DIRECT_CMD, &xnandps_smc_base->dcr); | ||
1081 | + | ||
1082 | + /* Wait till the ECC operation is complete */ | ||
1083 | + status = xnandps_waitfor_ecc_completion(); | ||
1084 | + if (status < 0) { | ||
1085 | + printf("xnandps_init_nand_flash: Timeout\n"); | ||
1086 | + return status; | ||
1087 | + } | ||
1088 | + | ||
1089 | + /* Set the command1 and command2 register */ | ||
1090 | + writel(XNANDPS_ECC_CMD1, &xnandps_smc_base->emcmd1r); | ||
1091 | + writel(XNANDPS_ECC_CMD2, &xnandps_smc_base->emcmd2r); | ||
1092 | + | ||
1093 | + return 0; | ||
1094 | +} | ||
1095 | + | ||
1096 | +/* | ||
1097 | + * xnandps_calculate_hwecc - Calculate Hardware ECC | ||
1098 | + * @mtd: Pointer to the mtd_info structure | ||
1099 | + * @data: Pointer to the page data | ||
1100 | + * @ecc_code: Pointer to the ECC buffer where ECC data needs to be stored | ||
1101 | + * | ||
1102 | + * This function retrieves the Hardware ECC data from the controller and returns | ||
1103 | + * ECC data back to the MTD subsystem. | ||
1104 | + * | ||
1105 | + * returns: 0 on success or error value on failure | ||
1106 | + */ | ||
1107 | +static int xnandps_calculate_hwecc(struct mtd_info *mtd, const u8 *data, | ||
1108 | + u8 *ecc_code) | ||
1109 | +{ | ||
1110 | + u32 ecc_value = 0; | ||
1111 | + u8 ecc_reg, ecc_byte; | ||
1112 | + u32 ecc_status; | ||
1113 | + | ||
1114 | + /* Wait till the ECC operation is complete */ | ||
1115 | + ecc_status = xnandps_waitfor_ecc_completion(); | ||
1116 | + if (ecc_status < 0) { | ||
1117 | + printf("xnandps_calculate_hwecc: Timeout\n"); | ||
1118 | + return ecc_status; | ||
1119 | + } | ||
1120 | + | ||
1121 | + for (ecc_reg = 0; ecc_reg < 4; ecc_reg++) { | ||
1122 | + /* Read ECC value for each block */ | ||
1123 | + ecc_value = readl(&xnandps_smc_base->eval0r + ecc_reg); | ||
1124 | + ecc_status = (ecc_value >> 24) & 0xFF; | ||
1125 | + /* ECC value valid */ | ||
1126 | + if (ecc_status & 0x40) { | ||
1127 | + for (ecc_byte = 0; ecc_byte < 3; ecc_byte++) { | ||
1128 | + /* Copy ECC bytes to MTD buffer */ | ||
1129 | + *ecc_code = ecc_value & 0xFF; | ||
1130 | + ecc_value = ecc_value >> 8; | ||
1131 | + ecc_code++; | ||
1132 | + } | ||
1133 | + } else { | ||
1134 | + debug("xnandps_calculate_hwecc: ecc status failed\n"); | ||
1135 | + } | ||
1136 | + } | ||
1137 | + return 0; | ||
1138 | +} | ||
1139 | + | ||
1140 | +/* | ||
1141 | + * onehot - onehot function | ||
1142 | + * @value: value to check for onehot | ||
1143 | + * | ||
1144 | + * This function checks whether a value is onehot or not. | ||
1145 | + * onehot is if and only if onebit is set. | ||
1146 | + * | ||
1147 | + */ | ||
1148 | +static int onehot(unsigned short value) | ||
1149 | +{ | ||
1150 | + return ((value & (value-1)) == 0); | ||
1151 | +} | ||
1152 | + | ||
1153 | +/* | ||
1154 | + * xnandps_correct_data - ECC correction function | ||
1155 | + * @mtd: Pointer to the mtd_info structure | ||
1156 | + * @buf: Pointer to the page data | ||
1157 | + * @read_ecc: Pointer to the ECC value read from spare data area | ||
1158 | + * @calc_ecc: Pointer to the calculated ECC value | ||
1159 | + * | ||
1160 | + * This function corrects the ECC single bit errors & detects 2-bit errors. | ||
1161 | + * | ||
1162 | + * returns: 0 if no ECC errors found | ||
1163 | + * 1 if single bit error found and corrected. | ||
1164 | + * -1 if multiple ECC errors found. | ||
1165 | + */ | ||
1166 | +static int xnandps_correct_data(struct mtd_info *mtd, unsigned char *buf, | ||
1167 | + unsigned char *read_ecc, unsigned char *calc_ecc) | ||
1168 | +{ | ||
1169 | + unsigned char bit_addr; | ||
1170 | + unsigned int byte_addr; | ||
1171 | + unsigned short ecc_odd, ecc_even; | ||
1172 | + unsigned short read_ecc_lower, read_ecc_upper; | ||
1173 | + unsigned short calc_ecc_lower, calc_ecc_upper; | ||
1174 | + | ||
1175 | + read_ecc_lower = (read_ecc[0] | (read_ecc[1] << 8)) & 0xfff; | ||
1176 | + read_ecc_upper = ((read_ecc[1] >> 4) | (read_ecc[2] << 4)) & 0xfff; | ||
1177 | + | ||
1178 | + calc_ecc_lower = (calc_ecc[0] | (calc_ecc[1] << 8)) & 0xfff; | ||
1179 | + calc_ecc_upper = ((calc_ecc[1] >> 4) | (calc_ecc[2] << 4)) & 0xfff; | ||
1180 | + | ||
1181 | + ecc_odd = read_ecc_lower ^ calc_ecc_lower; | ||
1182 | + ecc_even = read_ecc_upper ^ calc_ecc_upper; | ||
1183 | + | ||
1184 | + if ((ecc_odd == 0) && (ecc_even == 0)) | ||
1185 | + return 0; /* no error */ | ||
1186 | + else if (ecc_odd == (~ecc_even & 0xfff)) { | ||
1187 | + /* bits [11:3] of error code is byte offset */ | ||
1188 | + byte_addr = (ecc_odd >> 3) & 0x1ff; | ||
1189 | + /* bits [2:0] of error code is bit offset */ | ||
1190 | + bit_addr = ecc_odd & 0x7; | ||
1191 | + /* Toggling error bit */ | ||
1192 | + buf[byte_addr] ^= (1 << bit_addr); | ||
1193 | + return 1; | ||
1194 | + } else if (onehot(ecc_odd | ecc_even) == 1) { | ||
1195 | + return 1; /* one error in parity */ | ||
1196 | + } else { | ||
1197 | + return -1; /* Uncorrectable error */ | ||
1198 | + } | ||
1199 | +} | ||
1200 | + | ||
1201 | +/* | ||
1202 | + * xnandps_read_oob - [REPLACABLE] the most common OOB data read function | ||
1203 | + * @mtd: mtd info structure | ||
1204 | + * @chip: nand chip info structure | ||
1205 | + * @page: page number to read | ||
1206 | + * @sndcmd: flag whether to issue read command or not | ||
1207 | + */ | ||
1208 | +static int xnandps_read_oob(struct mtd_info *mtd, struct nand_chip *chip, | ||
1209 | + int page, int sndcmd) | ||
1210 | +{ | ||
1211 | + unsigned long data_width = 4; | ||
1212 | + unsigned long data_phase_addr = 0; | ||
1213 | + uint8_t *p; | ||
1214 | + | ||
1215 | + if (sndcmd) { | ||
1216 | + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); | ||
1217 | + sndcmd = 0; | ||
1218 | + } | ||
1219 | + | ||
1220 | + p = chip->oob_poi; | ||
1221 | + chip->read_buf(mtd, p, (mtd->oobsize - data_width)); | ||
1222 | + p += (mtd->oobsize - data_width); | ||
1223 | + | ||
1224 | + data_phase_addr = (unsigned long)chip->IO_ADDR_R; | ||
1225 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1226 | + chip->IO_ADDR_R = (void __iomem *)data_phase_addr; | ||
1227 | + chip->read_buf(mtd, p, data_width); | ||
1228 | + | ||
1229 | + return sndcmd; | ||
1230 | +} | ||
1231 | + | ||
1232 | +/* | ||
1233 | + * xnandps_write_oob - [REPLACABLE] the most common OOB data write function | ||
1234 | + * @mtd: mtd info structure | ||
1235 | + * @chip: nand chip info structure | ||
1236 | + * @page: page number to write | ||
1237 | + */ | ||
1238 | +static int xnandps_write_oob(struct mtd_info *mtd, struct nand_chip *chip, | ||
1239 | + int page) | ||
1240 | +{ | ||
1241 | + int status = 0; | ||
1242 | + const uint8_t *buf = chip->oob_poi; | ||
1243 | + unsigned long data_width = 4; | ||
1244 | + unsigned long data_phase_addr = 0; | ||
1245 | + | ||
1246 | + chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page); | ||
1247 | + | ||
1248 | + chip->write_buf(mtd, buf, (mtd->oobsize - data_width)); | ||
1249 | + buf += (mtd->oobsize - data_width); | ||
1250 | + | ||
1251 | + data_phase_addr = (unsigned long) chip->IO_ADDR_W; | ||
1252 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1253 | + data_phase_addr |= (1 << END_CMD_VALID_SHIFT); | ||
1254 | + chip->IO_ADDR_W = (void __iomem *) data_phase_addr; | ||
1255 | + chip->write_buf(mtd, buf, data_width); | ||
1256 | + | ||
1257 | + /* Send command to program the OOB data */ | ||
1258 | + chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); | ||
1259 | + status = chip->waitfunc(mtd, chip); | ||
1260 | + if (status) | ||
1261 | + return NAND_STATUS_FAIL; | ||
1262 | + | ||
1263 | + return status; | ||
1264 | +} | ||
1265 | + | ||
1266 | +/* | ||
1267 | + * xnandps_read_page_raw - [Intern] read raw page data without ecc | ||
1268 | + * @mtd: mtd info structure | ||
1269 | + * @chip: nand chip info structure | ||
1270 | + * @buf: buffer to store read data | ||
1271 | + * @page: page number to read | ||
1272 | + */ | ||
1273 | +static int xnandps_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | ||
1274 | + uint8_t *buf, int page) | ||
1275 | +{ | ||
1276 | + unsigned long data_width = 4; | ||
1277 | + unsigned long data_phase_addr = 0; | ||
1278 | + uint8_t *p; | ||
1279 | + | ||
1280 | + chip->read_buf(mtd, buf, mtd->writesize); | ||
1281 | + | ||
1282 | + p = chip->oob_poi; | ||
1283 | + chip->read_buf(mtd, p, (mtd->oobsize - data_width)); | ||
1284 | + p += (mtd->oobsize - data_width); | ||
1285 | + | ||
1286 | + data_phase_addr = (unsigned long) chip->IO_ADDR_R; | ||
1287 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1288 | + chip->IO_ADDR_R = (void __iomem *) data_phase_addr; | ||
1289 | + | ||
1290 | + chip->read_buf(mtd, p, data_width); | ||
1291 | + return 0; | ||
1292 | +} | ||
1293 | + | ||
1294 | +static int xnandps_read_page_raw_nooob(struct mtd_info *mtd, | ||
1295 | + struct nand_chip *chip, uint8_t *buf, int page) | ||
1296 | +{ | ||
1297 | + chip->read_buf(mtd, buf, mtd->writesize); | ||
1298 | + return 0; | ||
1299 | +} | ||
1300 | + | ||
1301 | +static int xnandps_read_subpage_raw(struct mtd_info *mtd, | ||
1302 | + struct nand_chip *chip, uint32_t data_offs, | ||
1303 | + uint32_t readlen, uint8_t *buf) | ||
1304 | +{ | ||
1305 | + if (data_offs != 0) { | ||
1306 | + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_offs, -1); | ||
1307 | + buf += data_offs; | ||
1308 | + } | ||
1309 | + | ||
1310 | + chip->read_buf(mtd, buf, readlen); | ||
1311 | + return 0; | ||
1312 | +} | ||
1313 | + | ||
1314 | +/* | ||
1315 | + * xnandps_write_page_raw - [Intern] raw page write function | ||
1316 | + * @mtd: mtd info structure | ||
1317 | + * @chip: nand chip info structure | ||
1318 | + * @buf: data buffer | ||
1319 | + */ | ||
1320 | +static void xnandps_write_page_raw(struct mtd_info *mtd, | ||
1321 | + struct nand_chip *chip, const uint8_t *buf) | ||
1322 | +{ | ||
1323 | + unsigned long data_width = 4; | ||
1324 | + unsigned long data_phase_addr = 0; | ||
1325 | + uint8_t *p; | ||
1326 | + | ||
1327 | + chip->write_buf(mtd, buf, mtd->writesize); | ||
1328 | + | ||
1329 | + p = chip->oob_poi; | ||
1330 | + chip->write_buf(mtd, p, (mtd->oobsize - data_width)); | ||
1331 | + p += (mtd->oobsize - data_width); | ||
1332 | + | ||
1333 | + data_phase_addr = (unsigned long) chip->IO_ADDR_W; | ||
1334 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1335 | + data_phase_addr |= (1 << END_CMD_VALID_SHIFT); | ||
1336 | + chip->IO_ADDR_W = (void __iomem *) data_phase_addr; | ||
1337 | + | ||
1338 | + chip->write_buf(mtd, p, data_width); | ||
1339 | +} | ||
1340 | + | ||
1341 | +/* | ||
1342 | + * nand_write_page_hwecc - Hardware ECC based page write function | ||
1343 | + * @mtd: Pointer to the mtd info structure | ||
1344 | + * @chip: Pointer to the NAND chip info structure | ||
1345 | + * @buf: Pointer to the data buffer | ||
1346 | + * | ||
1347 | + * This functions writes data and hardware generated ECC values in to the page. | ||
1348 | + */ | ||
1349 | +static void xnandps_write_page_hwecc(struct mtd_info *mtd, | ||
1350 | + struct nand_chip *chip, const uint8_t *buf) | ||
1351 | +{ | ||
1352 | + int i, eccsize = chip->ecc.size; | ||
1353 | + int eccsteps = chip->ecc.steps; | ||
1354 | + uint8_t *ecc_calc = chip->buffers->ecccalc; | ||
1355 | + const uint8_t *p = buf; | ||
1356 | + uint32_t *eccpos = chip->ecc.layout->eccpos; | ||
1357 | + unsigned long data_phase_addr = 0; | ||
1358 | + unsigned long data_width = 4; | ||
1359 | + uint8_t *oob_ptr; | ||
1360 | + | ||
1361 | + for ( ; (eccsteps - 1); eccsteps--) { | ||
1362 | + chip->write_buf(mtd, p, eccsize); | ||
1363 | + p += eccsize; | ||
1364 | + } | ||
1365 | + chip->write_buf(mtd, p, (eccsize - data_width)); | ||
1366 | + p += (eccsize - data_width); | ||
1367 | + | ||
1368 | + /* Set ECC Last bit to 1 */ | ||
1369 | + data_phase_addr = (unsigned long) chip->IO_ADDR_W; | ||
1370 | + data_phase_addr |= XNANDPS_ECC_LAST; | ||
1371 | + chip->IO_ADDR_W = (void __iomem *) data_phase_addr; | ||
1372 | + chip->write_buf(mtd, p, data_width); | ||
1373 | + | ||
1374 | + /* Wait for ECC to be calculated and read the error values */ | ||
1375 | + p = buf; | ||
1376 | + chip->ecc.calculate(mtd, p, &ecc_calc[0]); | ||
1377 | + | ||
1378 | + for (i = 0; i < chip->ecc.total; i++) | ||
1379 | + chip->oob_poi[eccpos[i]] = ~(ecc_calc[i]); | ||
1380 | + | ||
1381 | + /* Clear ECC last bit */ | ||
1382 | + data_phase_addr = (unsigned long)chip->IO_ADDR_W; | ||
1383 | + data_phase_addr &= ~XNANDPS_ECC_LAST; | ||
1384 | + chip->IO_ADDR_W = (void __iomem *)data_phase_addr; | ||
1385 | + | ||
1386 | + /* Write the spare area with ECC bytes */ | ||
1387 | + oob_ptr = chip->oob_poi; | ||
1388 | + chip->write_buf(mtd, oob_ptr, (mtd->oobsize - data_width)); | ||
1389 | + | ||
1390 | + data_phase_addr = (unsigned long)chip->IO_ADDR_W; | ||
1391 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1392 | + data_phase_addr |= (1 << END_CMD_VALID_SHIFT); | ||
1393 | + chip->IO_ADDR_W = (void __iomem *)data_phase_addr; | ||
1394 | + oob_ptr += (mtd->oobsize - data_width); | ||
1395 | + chip->write_buf(mtd, oob_ptr, data_width); | ||
1396 | +} | ||
1397 | + | ||
1398 | +/* | ||
1399 | + * xnandps_write_page_swecc - [REPLACABLE] software ecc based page | ||
1400 | + * write function | ||
1401 | + * @mtd: mtd info structure | ||
1402 | + * @chip: nand chip info structure | ||
1403 | + * @buf: data buffer | ||
1404 | + */ | ||
1405 | +static void xnandps_write_page_swecc(struct mtd_info *mtd, | ||
1406 | + struct nand_chip *chip, const uint8_t *buf) | ||
1407 | +{ | ||
1408 | + int i, eccsize = chip->ecc.size; | ||
1409 | + int eccbytes = chip->ecc.bytes; | ||
1410 | + int eccsteps = chip->ecc.steps; | ||
1411 | + uint8_t *ecc_calc = chip->buffers->ecccalc; | ||
1412 | + const uint8_t *p = buf; | ||
1413 | + uint32_t *eccpos = chip->ecc.layout->eccpos; | ||
1414 | + | ||
1415 | + /* Software ecc calculation */ | ||
1416 | + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) | ||
1417 | + chip->ecc.calculate(mtd, p, &ecc_calc[i]); | ||
1418 | + | ||
1419 | + for (i = 0; i < chip->ecc.total; i++) | ||
1420 | + chip->oob_poi[eccpos[i]] = ecc_calc[i]; | ||
1421 | + | ||
1422 | + chip->ecc.write_page_raw(mtd, chip, buf); | ||
1423 | +} | ||
1424 | + | ||
1425 | +/* | ||
1426 | + * nand_read_page_hwecc - Hardware ECC based page read function | ||
1427 | + * @mtd: Pointer to the mtd info structure | ||
1428 | + * @chip: Pointer to the NAND chip info structure | ||
1429 | + * @buf: Pointer to the buffer to store read data | ||
1430 | + * @page: page number to read | ||
1431 | + * | ||
1432 | + * This functions reads data and checks the data integrity by comparing hardware | ||
1433 | + * generated ECC values and read ECC values from spare area. | ||
1434 | + * | ||
1435 | + * returns: 0 always and updates ECC operation status in to MTD structure | ||
1436 | + */ | ||
1437 | +static int xnandps_read_page_hwecc(struct mtd_info *mtd, | ||
1438 | + struct nand_chip *chip, uint8_t *buf, int page) | ||
1439 | +{ | ||
1440 | + int i, stat, eccsize = chip->ecc.size; | ||
1441 | + int eccbytes = chip->ecc.bytes; | ||
1442 | + int eccsteps = chip->ecc.steps; | ||
1443 | + uint8_t *p = buf; | ||
1444 | + uint8_t *ecc_calc = chip->buffers->ecccalc; | ||
1445 | + uint8_t *ecc_code = chip->buffers->ecccode; | ||
1446 | + uint32_t *eccpos = chip->ecc.layout->eccpos; | ||
1447 | + unsigned long data_phase_addr = 0; | ||
1448 | + unsigned long data_width = 4; | ||
1449 | + uint8_t *oob_ptr; | ||
1450 | + | ||
1451 | + for ( ; (eccsteps - 1); eccsteps--) { | ||
1452 | + chip->read_buf(mtd, p, eccsize); | ||
1453 | + p += eccsize; | ||
1454 | + } | ||
1455 | + chip->read_buf(mtd, p, (eccsize - data_width)); | ||
1456 | + p += (eccsize - data_width); | ||
1457 | + | ||
1458 | + /* Set ECC Last bit to 1 */ | ||
1459 | + data_phase_addr = (unsigned long)chip->IO_ADDR_R; | ||
1460 | + data_phase_addr |= XNANDPS_ECC_LAST; | ||
1461 | + chip->IO_ADDR_R = (void __iomem *)data_phase_addr; | ||
1462 | + chip->read_buf(mtd, p, data_width); | ||
1463 | + | ||
1464 | + /* Read the calculated ECC value */ | ||
1465 | + p = buf; | ||
1466 | + chip->ecc.calculate(mtd, p, &ecc_calc[0]); | ||
1467 | + | ||
1468 | + /* Clear ECC last bit */ | ||
1469 | + data_phase_addr = (unsigned long)chip->IO_ADDR_R; | ||
1470 | + data_phase_addr &= ~XNANDPS_ECC_LAST; | ||
1471 | + chip->IO_ADDR_R = (void __iomem *)data_phase_addr; | ||
1472 | + | ||
1473 | + /* Read the stored ECC value */ | ||
1474 | + oob_ptr = chip->oob_poi; | ||
1475 | + chip->read_buf(mtd, oob_ptr, (mtd->oobsize - data_width)); | ||
1476 | + | ||
1477 | + /* de-assert chip select */ | ||
1478 | + data_phase_addr = (unsigned long)chip->IO_ADDR_R; | ||
1479 | + data_phase_addr |= XNANDPS_CLEAR_CS; | ||
1480 | + chip->IO_ADDR_R = (void __iomem *)data_phase_addr; | ||
1481 | + | ||
1482 | + oob_ptr += (mtd->oobsize - data_width); | ||
1483 | + chip->read_buf(mtd, oob_ptr, data_width); | ||
1484 | + | ||
1485 | + for (i = 0; i < chip->ecc.total; i++) | ||
1486 | + ecc_code[i] = ~(chip->oob_poi[eccpos[i]]); | ||
1487 | + | ||
1488 | + eccsteps = chip->ecc.steps; | ||
1489 | + p = buf; | ||
1490 | + | ||
1491 | + /* Check ECC error for all blocks and correct if it is correctable */ | ||
1492 | + for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | ||
1493 | + stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); | ||
1494 | + if (stat < 0) | ||
1495 | + mtd->ecc_stats.failed++; | ||
1496 | + else | ||
1497 | + mtd->ecc_stats.corrected += stat; | ||
1498 | + } | ||
1499 | + return 0; | ||
1500 | +} | ||
1501 | + | ||
1502 | +/* | ||
1503 | + * xnandps_read_page_swecc - [REPLACABLE] software ecc based page | ||
1504 | + * read function | ||
1505 | + * @mtd: mtd info structure | ||
1506 | + * @chip: nand chip info structure | ||
1507 | + * @buf: buffer to store read data | ||
1508 | + * @page: page number to read | ||
1509 | + */ | ||
1510 | +static int xnandps_read_page_swecc(struct mtd_info *mtd, | ||
1511 | + struct nand_chip *chip, uint8_t *buf, int page) | ||
1512 | +{ | ||
1513 | + int i, eccsize = chip->ecc.size; | ||
1514 | + int eccbytes = chip->ecc.bytes; | ||
1515 | + int eccsteps = chip->ecc.steps; | ||
1516 | + uint8_t *p = buf; | ||
1517 | + uint8_t *ecc_calc = chip->buffers->ecccalc; | ||
1518 | + uint8_t *ecc_code = chip->buffers->ecccode; | ||
1519 | + uint32_t *eccpos = chip->ecc.layout->eccpos; | ||
1520 | + | ||
1521 | + chip->ecc.read_page_raw(mtd, chip, buf, page); | ||
1522 | + | ||
1523 | + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) | ||
1524 | + chip->ecc.calculate(mtd, p, &ecc_calc[i]); | ||
1525 | + | ||
1526 | + for (i = 0; i < chip->ecc.total; i++) | ||
1527 | + ecc_code[i] = chip->oob_poi[eccpos[i]]; | ||
1528 | + | ||
1529 | + eccsteps = chip->ecc.steps; | ||
1530 | + p = buf; | ||
1531 | + | ||
1532 | + for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | ||
1533 | + int stat; | ||
1534 | + | ||
1535 | + stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); | ||
1536 | + if (stat < 0) | ||
1537 | + mtd->ecc_stats.failed++; | ||
1538 | + else | ||
1539 | + mtd->ecc_stats.corrected += stat; | ||
1540 | + } | ||
1541 | + return 0; | ||
1542 | +} | ||
1543 | + | ||
1544 | +/* | ||
1545 | + * xnandps_select_chip - Select the flash device | ||
1546 | + * @mtd: Pointer to the mtd_info structure | ||
1547 | + * @chip: Chip number to be selected | ||
1548 | + * | ||
1549 | + * This function is empty as the NAND controller handles chip select line | ||
1550 | + * internally based on the chip address passed in command and data phase. | ||
1551 | + */ | ||
1552 | +static void xnandps_select_chip(struct mtd_info *mtd, int chip) | ||
1553 | +{ | ||
1554 | + return; | ||
1555 | +} | ||
1556 | + | ||
1557 | +/* | ||
1558 | + * xnandps_cmd_function - Send command to NAND device | ||
1559 | + * @mtd: Pointer to the mtd_info structure | ||
1560 | + * @command: The command to be sent to the flash device | ||
1561 | + * @column: The column address for this command, -1 if none | ||
1562 | + * @page_addr: The page address for this command, -1 if none | ||
1563 | + */ | ||
1564 | +static void xnandps_cmd_function(struct mtd_info *mtd, unsigned int command, | ||
1565 | + int column, int page_addr) | ||
1566 | +{ | ||
1567 | + struct nand_chip *chip = mtd->priv; | ||
1568 | + const struct xnandps_command_format *curr_cmd = NULL; | ||
1569 | + struct xnandps_info *xnand; | ||
1570 | + void *cmd_addr; | ||
1571 | + unsigned long cmd_data = 0; | ||
1572 | + unsigned long cmd_phase_addr = 0; | ||
1573 | + unsigned long data_phase_addr = 0; | ||
1574 | + unsigned long end_cmd = 0; | ||
1575 | + unsigned long end_cmd_valid = 0; | ||
1576 | + unsigned long i; | ||
1577 | + | ||
1578 | + xnand = (struct xnandps_info *)chip->priv; | ||
1579 | + if (xnand->end_cmd_pending) { | ||
1580 | + /* Check for end command if this command request is same as the | ||
1581 | + * pending command then return | ||
1582 | + */ | ||
1583 | + if (xnand->end_cmd == command) { | ||
1584 | + xnand->end_cmd = 0; | ||
1585 | + xnand->end_cmd_pending = 0; | ||
1586 | + return; | ||
1587 | + } | ||
1588 | + } | ||
1589 | + | ||
1590 | + /* Emulate NAND_CMD_READOOB for large page device */ | ||
1591 | + if ((mtd->writesize > XNANDPS_ECC_SIZE) && | ||
1592 | + (command == NAND_CMD_READOOB)) { | ||
1593 | + column += mtd->writesize; | ||
1594 | + command = NAND_CMD_READ0; | ||
1595 | + } | ||
1596 | + | ||
1597 | + /* Get the command format */ | ||
1598 | + for (i = 0; (xnandps_commands[i].start_cmd != NAND_CMD_NONE || | ||
1599 | + xnandps_commands[i].end_cmd != NAND_CMD_NONE); i++) { | ||
1600 | + if (command == xnandps_commands[i].start_cmd) | ||
1601 | + curr_cmd = &xnandps_commands[i]; | ||
1602 | + } | ||
1603 | + if (curr_cmd == NULL) | ||
1604 | + return; | ||
1605 | + | ||
1606 | + /* Clear interrupt */ | ||
1607 | + writel((1 << 4), &xnandps_smc_base->cfr); | ||
1608 | + | ||
1609 | + /* Get the command phase address */ | ||
1610 | + if (curr_cmd->end_cmd_valid == XNANDPS_CMD_PHASE) | ||
1611 | + end_cmd_valid = 1; | ||
1612 | + | ||
1613 | + if (curr_cmd->end_cmd == NAND_CMD_NONE) | ||
1614 | + end_cmd = 0x0; | ||
1615 | + else | ||
1616 | + end_cmd = curr_cmd->end_cmd; | ||
1617 | + | ||
1618 | + cmd_phase_addr = (unsigned long)xnand->nand_base | | ||
1619 | + (curr_cmd->addr_cycles << ADDR_CYCLES_SHIFT) | | ||
1620 | + (end_cmd_valid << END_CMD_VALID_SHIFT) | | ||
1621 | + (COMMAND_PHASE) | | ||
1622 | + (end_cmd << END_CMD_SHIFT) | | ||
1623 | + (curr_cmd->start_cmd << START_CMD_SHIFT); | ||
1624 | + | ||
1625 | + cmd_addr = (void __iomem *)cmd_phase_addr; | ||
1626 | + | ||
1627 | + /* Get the data phase address */ | ||
1628 | + end_cmd_valid = 0; | ||
1629 | + | ||
1630 | + data_phase_addr = (unsigned long)xnand->nand_base | | ||
1631 | + (0x0 << CLEAR_CS_SHIFT) | | ||
1632 | + (end_cmd_valid << END_CMD_VALID_SHIFT) | | ||
1633 | + (DATA_PHASE) | | ||
1634 | + (end_cmd << END_CMD_SHIFT) | | ||
1635 | + (0x0 << ECC_LAST_SHIFT); | ||
1636 | + | ||
1637 | + chip->IO_ADDR_R = (void __iomem *)data_phase_addr; | ||
1638 | + chip->IO_ADDR_W = chip->IO_ADDR_R; | ||
1639 | + | ||
1640 | + /* Command phase AXI Read & Write */ | ||
1641 | + if (column != -1 && page_addr != -1) { | ||
1642 | + /* Adjust columns for 16 bit bus width */ | ||
1643 | + if (chip->options & NAND_BUSWIDTH_16) | ||
1644 | + column >>= 1; | ||
1645 | + cmd_data = column; | ||
1646 | + if (mtd->writesize > XNANDPS_ECC_SIZE) { | ||
1647 | + cmd_data |= page_addr << 16; | ||
1648 | + /* Another address cycle for devices > 128MiB */ | ||
1649 | + if (chip->chipsize > (128 << 20)) { | ||
1650 | + writel(cmd_data, cmd_addr); | ||
1651 | + cmd_data = (page_addr >> 16); | ||
1652 | + } | ||
1653 | + } else | ||
1654 | + cmd_data |= page_addr << 8; | ||
1655 | + } | ||
1656 | + /* Erase */ | ||
1657 | + else if (page_addr != -1) | ||
1658 | + cmd_data = page_addr; | ||
1659 | + /* Change read/write column, read id etc */ | ||
1660 | + else if (column != -1) { | ||
1661 | + /* Adjust columns for 16 bit bus width */ | ||
1662 | + if ((chip->options & NAND_BUSWIDTH_16) && | ||
1663 | + ((command == NAND_CMD_READ0) || | ||
1664 | + (command == NAND_CMD_SEQIN) || | ||
1665 | + (command == NAND_CMD_RNDOUT) || | ||
1666 | + (command == NAND_CMD_RNDIN))) | ||
1667 | + column >>= 1; | ||
1668 | + cmd_data = column; | ||
1669 | + } else | ||
1670 | + ; | ||
1671 | + | ||
1672 | + writel(cmd_data, cmd_addr); | ||
1673 | + | ||
1674 | + if (curr_cmd->end_cmd_valid) { | ||
1675 | + xnand->end_cmd = curr_cmd->end_cmd; | ||
1676 | + xnand->end_cmd_pending = 1; | ||
1677 | + } | ||
1678 | + | ||
1679 | + ndelay(100); | ||
1680 | + | ||
1681 | + if ((command == NAND_CMD_READ0) || | ||
1682 | + (command == NAND_CMD_ERASE1) || | ||
1683 | + (command == NAND_CMD_RESET) || | ||
1684 | + (command == NAND_CMD_PARAM) || | ||
1685 | + (command == NAND_CMD_GET_FEATURES)) { | ||
1686 | + while (!chip->dev_ready(mtd)) | ||
1687 | + ; | ||
1688 | + return; | ||
1689 | + } | ||
1690 | +} | ||
1691 | + | ||
1692 | +/* | ||
1693 | + * xnandps_read_buf - read chip data into buffer | ||
1694 | + * @mtd: MTD device structure | ||
1695 | + * @buf: buffer to store date | ||
1696 | + * @len: number of bytes to read | ||
1697 | + */ | ||
1698 | +static void xnandps_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) | ||
1699 | +{ | ||
1700 | + struct nand_chip *chip = mtd->priv; | ||
1701 | + const u32 *nand = chip->IO_ADDR_R; | ||
1702 | + | ||
1703 | + /* Make sure that buf is 32 bit aligned */ | ||
1704 | + if (((int)buf & 0x3) != 0) { | ||
1705 | + if (((int)buf & 0x1) != 0) { | ||
1706 | + if (len) { | ||
1707 | + *buf = readb(nand); | ||
1708 | + buf += 1; | ||
1709 | + len--; | ||
1710 | + } | ||
1711 | + } | ||
1712 | + | ||
1713 | + if (((int)buf & 0x3) != 0) { | ||
1714 | + if (len >= 2) { | ||
1715 | + *(u16 *)buf = readw(nand); | ||
1716 | + buf += 2; | ||
1717 | + len -= 2; | ||
1718 | + } | ||
1719 | + } | ||
1720 | + } | ||
1721 | + | ||
1722 | + /* copy aligned data */ | ||
1723 | + while (len >= 4) { | ||
1724 | + *(u32 *)buf = readl(nand); | ||
1725 | + buf += 4; | ||
1726 | + len -= 4; | ||
1727 | + } | ||
1728 | + | ||
1729 | + /* mop up any remaining bytes */ | ||
1730 | + if (len) { | ||
1731 | + if (len >= 2) { | ||
1732 | + *(u16 *)buf = readw(nand); | ||
1733 | + buf += 2; | ||
1734 | + len -= 2; | ||
1735 | + } | ||
1736 | + | ||
1737 | + if (len) | ||
1738 | + *buf = readb(nand); | ||
1739 | + } | ||
1740 | +} | ||
1741 | + | ||
1742 | +/* | ||
1743 | + * xnandps_write_buf - write buffer to chip | ||
1744 | + * @mtd: MTD device structure | ||
1745 | + * @buf: data buffer | ||
1746 | + * @len: number of bytes to write | ||
1747 | + */ | ||
1748 | +static void xnandps_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) | ||
1749 | +{ | ||
1750 | + struct nand_chip *chip = mtd->priv; | ||
1751 | + const u32 *nand = chip->IO_ADDR_W; | ||
1752 | + | ||
1753 | + /* Make sure that buf is 32 bit aligned */ | ||
1754 | + if (((int)buf & 0x3) != 0) { | ||
1755 | + if (((int)buf & 0x1) != 0) { | ||
1756 | + if (len) { | ||
1757 | + writeb(*buf, nand); | ||
1758 | + buf += 1; | ||
1759 | + len--; | ||
1760 | + } | ||
1761 | + } | ||
1762 | + | ||
1763 | + if (((int)buf & 0x3) != 0) { | ||
1764 | + if (len >= 2) { | ||
1765 | + writew(*(u16 *)buf, nand); | ||
1766 | + buf += 2; | ||
1767 | + len -= 2; | ||
1768 | + } | ||
1769 | + } | ||
1770 | + } | ||
1771 | + | ||
1772 | + /* copy aligned data */ | ||
1773 | + while (len >= 4) { | ||
1774 | + writel(*(u32 *)buf, nand); | ||
1775 | + buf += 4; | ||
1776 | + len -= 4; | ||
1777 | + } | ||
1778 | + | ||
1779 | + /* mop up any remaining bytes */ | ||
1780 | + if (len) { | ||
1781 | + if (len >= 2) { | ||
1782 | + writew(*(u16 *)buf, nand); | ||
1783 | + buf += 2; | ||
1784 | + len -= 2; | ||
1785 | + } | ||
1786 | + | ||
1787 | + if (len) | ||
1788 | + writeb(*buf, nand); | ||
1789 | + } | ||
1790 | +} | ||
1791 | + | ||
1792 | +/* | ||
1793 | + * xnandps_device_ready - Check device ready/busy line | ||
1794 | + * @mtd: Pointer to the mtd_info structure | ||
1795 | + * | ||
1796 | + * returns: 0 on busy or 1 on ready state | ||
1797 | + */ | ||
1798 | +static int xnandps_device_ready(struct mtd_info *mtd) | ||
1799 | +{ | ||
1800 | + /* Check the raw_int_status1 bit */ | ||
1801 | + if ((readl(&xnandps_smc_base->csr)) & 0x40) { | ||
1802 | + /* Clear the interrupt condition */ | ||
1803 | + writel((1<<4), &xnandps_smc_base->cfr); | ||
1804 | + return 1; | ||
1805 | + } | ||
1806 | + return 0; | ||
1807 | +} | ||
1808 | + | ||
1809 | +/* | ||
1810 | + * xnandps_check_is_16bit_bw_flash - checking for 16 or 8 bit buswidth nand | ||
1811 | + * | ||
1812 | + * This function will check nand buswidth whether it supports 16 or 8 bit | ||
1813 | + * based on the MIO configuration done by FSBL. | ||
1814 | + * | ||
1815 | + * User needs to correctly configure the MIO's based on the | ||
1816 | + * buswidth supported by the nand flash which is present on the board. | ||
1817 | + * | ||
1818 | + * function will return -1, if there is no MIO configuration for | ||
1819 | + * nand flash. | ||
1820 | + */ | ||
1821 | +static int xnandps_check_is_16bit_bw_flash(void) | ||
1822 | +{ | ||
1823 | + int is_16bit_bw = NAND_BW_UNKNOWN; | ||
1824 | + int mio_num_8bit = 0, mio_num_16bit = 0; | ||
1825 | + | ||
1826 | + mio_num_8bit = zynq_slcr_get_mio_pin_status("nand8"); | ||
1827 | + if (mio_num_8bit == XNANDPS_MIO_NUM_NAND_8BIT) | ||
1828 | + is_16bit_bw = NAND_BW_8BIT; | ||
1829 | + | ||
1830 | + mio_num_16bit = zynq_slcr_get_mio_pin_status("nand16"); | ||
1831 | + if ((mio_num_8bit == XNANDPS_MIO_NUM_NAND_8BIT) && | ||
1832 | + (mio_num_16bit == XNANDPS_MIO_NUM_NAND_16BIT)) | ||
1833 | + is_16bit_bw = NAND_BW_16BIT; | ||
1834 | + | ||
1835 | + return is_16bit_bw; | ||
1836 | +} | ||
1837 | + | ||
1838 | +int zynq_nand_init(struct nand_chip *nand_chip) | ||
1839 | +{ | ||
1840 | + struct xnandps_info *xnand; | ||
1841 | + struct mtd_info *mtd; | ||
1842 | + unsigned long ecc_page_size; | ||
1843 | + int err = -1; | ||
1844 | + u8 maf_id, dev_id, i; | ||
1845 | + u8 get_feature[4]; | ||
1846 | + u8 set_feature[4] = {0x08, 0x00, 0x00, 0x00}; | ||
1847 | + unsigned long ecc_cfg; | ||
1848 | + int ondie_ecc_enabled = 0; | ||
1849 | + int is_16bit_bw; | ||
1850 | + | ||
1851 | + xnand = malloc(sizeof(struct xnandps_info)); | ||
1852 | + memset(xnand, 0, sizeof(struct xnandps_info)); | ||
1853 | + if (!xnand) { | ||
1854 | + printf("zynq_nand_init: failed to allocate\n"); | ||
1855 | + goto free; | ||
1856 | + } | ||
1857 | + | ||
1858 | + xnand->nand_base = (void *)XPSS_NAND_BASEADDR; | ||
1859 | + mtd = &nand_info[0]; | ||
1860 | + | ||
1861 | + nand_chip->priv = xnand; | ||
1862 | + mtd->priv = nand_chip; | ||
1863 | + | ||
1864 | + /* Set address of NAND IO lines */ | ||
1865 | + nand_chip->IO_ADDR_R = xnand->nand_base; | ||
1866 | + nand_chip->IO_ADDR_W = xnand->nand_base; | ||
1867 | + | ||
1868 | + /* Set the driver entry points for MTD */ | ||
1869 | + nand_chip->cmdfunc = xnandps_cmd_function; | ||
1870 | + nand_chip->dev_ready = xnandps_device_ready; | ||
1871 | + nand_chip->select_chip = xnandps_select_chip; | ||
1872 | + | ||
1873 | + /* If we don't set this delay driver sets 20us by default */ | ||
1874 | + nand_chip->chip_delay = 30; | ||
1875 | + | ||
1876 | + /* Buffer read/write routines */ | ||
1877 | + nand_chip->read_buf = xnandps_read_buf; | ||
1878 | + nand_chip->write_buf = xnandps_write_buf; | ||
1879 | + | ||
1880 | + /* Check the NAND buswidth */ | ||
1881 | + is_16bit_bw = xnandps_check_is_16bit_bw_flash(); | ||
1882 | + if (is_16bit_bw == NAND_BW_UNKNOWN) { | ||
1883 | + printf("zynq_nand_init: Unable detect NAND based on" | ||
1884 | + " MIO settings\n"); | ||
1885 | + goto free; | ||
1886 | + } else if (is_16bit_bw == NAND_BW_8BIT) | ||
1887 | + nand_chip->options = NAND_NO_AUTOINCR | NAND_USE_FLASH_BBT; | ||
1888 | + else if (is_16bit_bw == NAND_BW_16BIT) | ||
1889 | + nand_chip->options = NAND_BUSWIDTH_16; | ||
1890 | + | ||
1891 | + /* Initialize the NAND flash interface on NAND controller */ | ||
1892 | + if (xnandps_init_nand_flash(nand_chip->options) < 0) { | ||
1893 | + printf("zynq_nand_init: nand flash init failed\n"); | ||
1894 | + goto free; | ||
1895 | + } | ||
1896 | + | ||
1897 | + /* first scan to find the device and get the page size */ | ||
1898 | + if (nand_scan_ident(mtd, 1, NULL)) { | ||
1899 | + printf("zynq_nand_init: nand_scan_ident failed\n"); | ||
1900 | + goto fail; | ||
1901 | + } | ||
1902 | + | ||
1903 | + /* Send the command for reading device ID */ | ||
1904 | + nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); | ||
1905 | + nand_chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); | ||
1906 | + | ||
1907 | + /* Read manufacturer and device IDs */ | ||
1908 | + maf_id = nand_chip->read_byte(mtd); | ||
1909 | + dev_id = nand_chip->read_byte(mtd); | ||
1910 | + | ||
1911 | + if ((maf_id == 0x2c) && ((dev_id == 0xf1) || | ||
1912 | + (dev_id == 0xa1) || (dev_id == 0xb1) || | ||
1913 | + (dev_id == 0xaa) || (dev_id == 0xba) || | ||
1914 | + (dev_id == 0xda) || (dev_id == 0xca) || | ||
1915 | + (dev_id == 0xac) || (dev_id == 0xbc) || | ||
1916 | + (dev_id == 0xdc) || (dev_id == 0xcc) || | ||
1917 | + (dev_id == 0xa3) || (dev_id == 0xb3) || | ||
1918 | + (dev_id == 0xd3) || (dev_id == 0xc3))) { | ||
1919 | + nand_chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, | ||
1920 | + ONDIE_ECC_FEATURE_ADDR, -1); | ||
1921 | + | ||
1922 | + for (i = 0; i < 4; i++) | ||
1923 | + writeb(set_feature[i], nand_chip->IO_ADDR_W); | ||
1924 | + | ||
1925 | + /* wait for 1us after writing data with SET_FEATURES command */ | ||
1926 | + ndelay(1000); | ||
1927 | + | ||
1928 | + nand_chip->cmdfunc(mtd, NAND_CMD_GET_FEATURES, | ||
1929 | + ONDIE_ECC_FEATURE_ADDR, -1); | ||
1930 | + nand_chip->read_buf(mtd, get_feature, 4); | ||
1931 | + | ||
1932 | + if (get_feature[0] & 0x08) { | ||
1933 | + debug("zynq_nand_init: OnDie ECC flash\n"); | ||
1934 | + ondie_ecc_enabled = 1; | ||
1935 | + } else | ||
1936 | + printf("zynq_nand_init: Unable to detect OnDie ECC\n"); | ||
1937 | + } | ||
1938 | + | ||
1939 | + if (ondie_ecc_enabled) { | ||
1940 | + /* bypass the controller ECC block */ | ||
1941 | + ecc_cfg = readl(&xnandps_smc_base->emcr); | ||
1942 | + ecc_cfg &= ~0xc; | ||
1943 | + writel(ecc_cfg, &xnandps_smc_base->emcr); | ||
1944 | + | ||
1945 | + /* The software ECC routines won't work | ||
1946 | + * with the SMC controller | ||
1947 | + */ | ||
1948 | + nand_chip->ecc.mode = NAND_ECC_HW; | ||
1949 | + nand_chip->ecc.read_page = xnandps_read_page_raw_nooob; | ||
1950 | + nand_chip->ecc.read_subpage = xnandps_read_subpage_raw; | ||
1951 | + nand_chip->ecc.write_page = xnandps_write_page_raw; | ||
1952 | + nand_chip->ecc.read_page_raw = xnandps_read_page_raw; | ||
1953 | + nand_chip->ecc.write_page_raw = xnandps_write_page_raw; | ||
1954 | + nand_chip->ecc.read_oob = xnandps_read_oob; | ||
1955 | + nand_chip->ecc.write_oob = xnandps_write_oob; | ||
1956 | + nand_chip->ecc.size = mtd->writesize; | ||
1957 | + nand_chip->ecc.bytes = 0; | ||
1958 | + | ||
1959 | + /* NAND with on-die ECC supports subpage reads */ | ||
1960 | + nand_chip->options |= NAND_SUBPAGE_READ; | ||
1961 | + | ||
1962 | + /* On-Die ECC spare bytes offset 8 is used for ECC codes */ | ||
1963 | + if (ondie_ecc_enabled) { | ||
1964 | + nand_chip->ecc.layout = &ondie_nand_oob_64; | ||
1965 | + /* Use the BBT pattern descriptors */ | ||
1966 | + nand_chip->bbt_td = &bbt_main_descr; | ||
1967 | + nand_chip->bbt_md = &bbt_mirror_descr; | ||
1968 | + } | ||
1969 | + } else { | ||
1970 | + /* Hardware ECC generates 3 bytes ECC code for each 512 bytes */ | ||
1971 | + nand_chip->ecc.mode = NAND_ECC_HW; | ||
1972 | + nand_chip->ecc.size = XNANDPS_ECC_SIZE; | ||
1973 | + nand_chip->ecc.bytes = 3; | ||
1974 | + nand_chip->ecc.calculate = xnandps_calculate_hwecc; | ||
1975 | + nand_chip->ecc.correct = xnandps_correct_data; | ||
1976 | + nand_chip->ecc.hwctl = NULL; | ||
1977 | + nand_chip->ecc.read_page = xnandps_read_page_hwecc; | ||
1978 | + nand_chip->ecc.write_page = xnandps_write_page_hwecc; | ||
1979 | + nand_chip->ecc.read_page_raw = xnandps_read_page_raw; | ||
1980 | + nand_chip->ecc.write_page_raw = xnandps_write_page_raw; | ||
1981 | + nand_chip->ecc.read_oob = xnandps_read_oob; | ||
1982 | + nand_chip->ecc.write_oob = xnandps_write_oob; | ||
1983 | + | ||
1984 | + switch (mtd->writesize) { | ||
1985 | + case 512: | ||
1986 | + ecc_page_size = 0x1; | ||
1987 | + /* Set the ECC memory config register */ | ||
1988 | + writel((XNANDPS_ECC_CONFIG | ecc_page_size), | ||
1989 | + &xnandps_smc_base->emcr); | ||
1990 | + break; | ||
1991 | + case 1024: | ||
1992 | + ecc_page_size = 0x2; | ||
1993 | + /* Set the ECC memory config register */ | ||
1994 | + writel((XNANDPS_ECC_CONFIG | ecc_page_size), | ||
1995 | + &xnandps_smc_base->emcr); | ||
1996 | + break; | ||
1997 | + case 2048: | ||
1998 | + ecc_page_size = 0x3; | ||
1999 | + /* Set the ECC memory config register */ | ||
2000 | + writel((XNANDPS_ECC_CONFIG | ecc_page_size), | ||
2001 | + &xnandps_smc_base->emcr); | ||
2002 | + break; | ||
2003 | + default: | ||
2004 | + /* The software ECC routines won't work with | ||
2005 | + * the SMC controller | ||
2006 | + */ | ||
2007 | + nand_chip->ecc.mode = NAND_ECC_HW; | ||
2008 | + nand_chip->ecc.calculate = nand_calculate_ecc; | ||
2009 | + nand_chip->ecc.correct = nand_correct_data; | ||
2010 | + nand_chip->ecc.read_page = xnandps_read_page_swecc; | ||
2011 | + /* nand_chip->ecc.read_subpage = nand_read_subpage; */ | ||
2012 | + nand_chip->ecc.write_page = xnandps_write_page_swecc; | ||
2013 | + nand_chip->ecc.read_page_raw = xnandps_read_page_raw; | ||
2014 | + nand_chip->ecc.write_page_raw = xnandps_write_page_raw; | ||
2015 | + nand_chip->ecc.read_oob = xnandps_read_oob; | ||
2016 | + nand_chip->ecc.write_oob = xnandps_write_oob; | ||
2017 | + nand_chip->ecc.size = 256; | ||
2018 | + nand_chip->ecc.bytes = 3; | ||
2019 | + break; | ||
2020 | + } | ||
2021 | + | ||
2022 | + if (mtd->oobsize == 16) | ||
2023 | + nand_chip->ecc.layout = &nand_oob_16; | ||
2024 | + else if (mtd->oobsize == 64) | ||
2025 | + nand_chip->ecc.layout = &nand_oob_64; | ||
2026 | + else | ||
2027 | + ; | ||
2028 | + } | ||
2029 | + | ||
2030 | + /* second phase scan */ | ||
2031 | + if (nand_scan_tail(mtd)) { | ||
2032 | + printf("zynq_nand_init: nand_scan_tailfailed\n"); | ||
2033 | + goto fail; | ||
2034 | + } | ||
2035 | + | ||
2036 | + return 0; | ||
2037 | +fail: | ||
2038 | + nand_release(mtd); | ||
2039 | +free: | ||
2040 | + kfree(xnand); | ||
2041 | + return err; | ||
2042 | +} | ||
2043 | diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c | ||
2044 | index 32b76e0..4f19ee0 100644 | ||
2045 | --- a/drivers/mtd/spi/spansion.c | ||
2046 | +++ b/drivers/mtd/spi/spansion.c | ||
2047 | @@ -31,6 +31,12 @@ | ||
2048 | |||
2049 | #include "spi_flash_internal.h" | ||
2050 | |||
2051 | +/* S25FLxx-specific commands */ | ||
2052 | +#define CMD_S25FLXX_SE 0xd8 /* Sector Erase */ | ||
2053 | +#define CMD_S25FLXX_BE 0xc7 /* Bulk Erase */ | ||
2054 | +#define CMD_S25FLXX_DP 0xb9 /* Deep Power-down */ | ||
2055 | +#define CMD_S25FLXX_RES 0xab /* Release from DP, and Read Signature */ | ||
2056 | + | ||
2057 | struct spansion_spi_flash_params { | ||
2058 | u16 idcode1; | ||
2059 | u16 idcode2; | ||
2060 | @@ -97,7 +103,7 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { | ||
2061 | .name = "S25FL129P_64K", | ||
2062 | }, | ||
2063 | { | ||
2064 | - .idcode1 = 0x2019, | ||
2065 | + .idcode1 = 0x0219, | ||
2066 | .idcode2 = 0x4d01, | ||
2067 | .pages_per_sector = 256, | ||
2068 | .nr_sectors = 512, | ||
2069 | @@ -142,7 +148,15 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) | ||
2070 | flash->read = spi_flash_cmd_read_fast; | ||
2071 | flash->page_size = 256; | ||
2072 | flash->sector_size = 256 * params->pages_per_sector; | ||
2073 | - flash->size = flash->sector_size * params->nr_sectors; | ||
2074 | + | ||
2075 | + /* address width is 4 for dual and 3 for single qspi */ | ||
2076 | + if (flash->spi->is_dual == 1) { | ||
2077 | + flash->addr_width = 4; | ||
2078 | + flash->size = flash->sector_size * (2 * params->nr_sectors); | ||
2079 | + } else { | ||
2080 | + flash->addr_width = 3; | ||
2081 | + flash->size = flash->sector_size * params->nr_sectors; | ||
2082 | + } | ||
2083 | |||
2084 | return flash; | ||
2085 | } | ||
2086 | diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c | ||
2087 | index 00aece9..44e2b61 100644 | ||
2088 | --- a/drivers/mtd/spi/spi_flash.c | ||
2089 | +++ b/drivers/mtd/spi/spi_flash.c | ||
2090 | @@ -15,12 +15,44 @@ | ||
2091 | |||
2092 | #include "spi_flash_internal.h" | ||
2093 | |||
2094 | -static void spi_flash_addr(u32 addr, u8 *cmd) | ||
2095 | +static void spi_flash_addr(struct spi_flash *flash, | ||
2096 | + unsigned long page_addr, unsigned long byte_addr, u8 *cmd) | ||
2097 | { | ||
2098 | /* cmd[0] is actual command */ | ||
2099 | - cmd[1] = addr >> 16; | ||
2100 | - cmd[2] = addr >> 8; | ||
2101 | - cmd[3] = addr >> 0; | ||
2102 | + if (flash->addr_width == 4) { | ||
2103 | + cmd[1] = page_addr >> 16; | ||
2104 | + cmd[2] = page_addr >> 8; | ||
2105 | + cmd[3] = page_addr; | ||
2106 | + cmd[4] = byte_addr; | ||
2107 | + } else { | ||
2108 | + cmd[1] = page_addr >> 8; | ||
2109 | + cmd[2] = page_addr; | ||
2110 | + cmd[3] = byte_addr; | ||
2111 | + } | ||
2112 | +} | ||
2113 | + | ||
2114 | +static int spi_flash_check_bankaddr_access(struct spi_flash *flash, u32 *offset) | ||
2115 | +{ | ||
2116 | + int ret; | ||
2117 | + | ||
2118 | + if (*offset >= 0x1000000) { | ||
2119 | + ret = spi_flash_bankaddr_access(flash, STATUS_BANKADDR_ENABLE); | ||
2120 | + if (ret) { | ||
2121 | + debug("SF: fail to %s bank addr bit\n", | ||
2122 | + STATUS_BANKADDR_ENABLE ? "set" : "reset"); | ||
2123 | + return ret; | ||
2124 | + } | ||
2125 | + *offset -= 0x1000000; | ||
2126 | + } else { | ||
2127 | + ret = spi_flash_bankaddr_access(flash, STATUS_BANKADDR_DISABLE); | ||
2128 | + if (ret) { | ||
2129 | + debug("SF: fail to %s bank addr bit\n", | ||
2130 | + STATUS_BANKADDR_DISABLE ? "set" : "reset"); | ||
2131 | + return ret; | ||
2132 | + } | ||
2133 | + } | ||
2134 | + | ||
2135 | + return ret; | ||
2136 | } | ||
2137 | |||
2138 | static int spi_flash_read_write(struct spi_slave *spi, | ||
2139 | @@ -71,7 +103,15 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, | ||
2140 | unsigned long page_addr, byte_addr, page_size; | ||
2141 | size_t chunk_len, actual; | ||
2142 | int ret; | ||
2143 | - u8 cmd[4]; | ||
2144 | + u8 cmd[flash->addr_width+1]; | ||
2145 | + | ||
2146 | + if ((flash->size > 0x1000000) && (flash->addr_width == 3)) { | ||
2147 | + ret = spi_flash_check_bankaddr_access(flash, &offset); | ||
2148 | + if (ret) { | ||
2149 | + debug("SF: fail to acess bank_addr\n"); | ||
2150 | + return ret; | ||
2151 | + } | ||
2152 | + } | ||
2153 | |||
2154 | page_size = flash->page_size; | ||
2155 | page_addr = offset / page_size; | ||
2156 | @@ -87,12 +127,11 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, | ||
2157 | for (actual = 0; actual < len; actual += chunk_len) { | ||
2158 | chunk_len = min(len - actual, page_size - byte_addr); | ||
2159 | |||
2160 | - cmd[1] = page_addr >> 8; | ||
2161 | - cmd[2] = page_addr; | ||
2162 | - cmd[3] = byte_addr; | ||
2163 | + spi_flash_addr(flash, page_addr, byte_addr, cmd); | ||
2164 | |||
2165 | - debug("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %zu\n", | ||
2166 | - buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); | ||
2167 | + debug("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x0x%02x } \ | ||
2168 | + chunk_len = %zu\n", buf + actual, cmd[0], cmd[1], | ||
2169 | + cmd[2], cmd[3], cmd[4], chunk_len); | ||
2170 | |||
2171 | ret = spi_flash_cmd_write_enable(flash); | ||
2172 | if (ret < 0) { | ||
2173 | @@ -100,7 +139,7 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, | ||
2174 | break; | ||
2175 | } | ||
2176 | |||
2177 | - ret = spi_flash_cmd_write(flash->spi, cmd, 4, | ||
2178 | + ret = spi_flash_cmd_write(flash->spi, cmd, sizeof(cmd), | ||
2179 | buf + actual, chunk_len); | ||
2180 | if (ret < 0) { | ||
2181 | debug("SF: write failed\n"); | ||
2182 | @@ -115,7 +154,7 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, | ||
2183 | byte_addr = 0; | ||
2184 | } | ||
2185 | |||
2186 | - debug("SF: program %s %zu bytes @ %#x\n", | ||
2187 | + printf("SF: program %s %zu bytes @ %#x\n", | ||
2188 | ret ? "failure" : "success", len, offset); | ||
2189 | |||
2190 | spi_release_bus(flash->spi); | ||
2191 | @@ -138,11 +177,27 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd, | ||
2192 | int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 offset, | ||
2193 | size_t len, void *data) | ||
2194 | { | ||
2195 | - u8 cmd[5]; | ||
2196 | + unsigned long page_addr; | ||
2197 | + unsigned long page_size; | ||
2198 | + unsigned long byte_addr; | ||
2199 | + u8 cmd[flash->addr_width+2]; | ||
2200 | + int ret; | ||
2201 | + | ||
2202 | + if ((flash->size > 0x1000000) && (flash->addr_width == 3)) { | ||
2203 | + ret = spi_flash_check_bankaddr_access(flash, &offset); | ||
2204 | + if (ret) { | ||
2205 | + debug("SF: fail to acess bank_addr\n"); | ||
2206 | + return ret; | ||
2207 | + } | ||
2208 | + } | ||
2209 | + | ||
2210 | + page_size = flash->page_size; | ||
2211 | + page_addr = offset / page_size; | ||
2212 | + byte_addr = offset % page_size; | ||
2213 | |||
2214 | cmd[0] = CMD_READ_ARRAY_FAST; | ||
2215 | - spi_flash_addr(offset, cmd); | ||
2216 | - cmd[4] = 0x00; | ||
2217 | + spi_flash_addr(flash, page_addr, byte_addr, cmd); | ||
2218 | + cmd[sizeof(cmd)-1] = 0x00; | ||
2219 | |||
2220 | return spi_flash_read_common(flash, cmd, sizeof(cmd), data, len); | ||
2221 | } | ||
2222 | @@ -194,7 +249,16 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len) | ||
2223 | { | ||
2224 | u32 start, end, erase_size; | ||
2225 | int ret; | ||
2226 | - u8 cmd[4]; | ||
2227 | + unsigned long page_addr; | ||
2228 | + u8 cmd[flash->addr_width+1]; | ||
2229 | + | ||
2230 | + if ((flash->size > 0x1000000) && (flash->addr_width == 3)) { | ||
2231 | + ret = spi_flash_check_bankaddr_access(flash, &offset); | ||
2232 | + if (ret) { | ||
2233 | + debug("SF: fail to acess bank_addr\n"); | ||
2234 | + return ret; | ||
2235 | + } | ||
2236 | + } | ||
2237 | |||
2238 | erase_size = flash->sector_size; | ||
2239 | if (offset % erase_size || len % erase_size) { | ||
2240 | @@ -216,11 +280,12 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len) | ||
2241 | end = start + len; | ||
2242 | |||
2243 | while (offset < end) { | ||
2244 | - spi_flash_addr(offset, cmd); | ||
2245 | + page_addr = offset / flash->page_size; | ||
2246 | + spi_flash_addr(flash, page_addr, 0, cmd); | ||
2247 | offset += erase_size; | ||
2248 | |||
2249 | - debug("SF: erase %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1], | ||
2250 | - cmd[2], cmd[3], offset); | ||
2251 | + debug("SF: erase %2x %2x %2x %2x %2x (%x)\n", cmd[0], cmd[1], | ||
2252 | + cmd[2], cmd[3], cmd[4], offset); | ||
2253 | |||
2254 | ret = spi_flash_cmd_write_enable(flash); | ||
2255 | if (ret) | ||
2256 | @@ -235,7 +300,7 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len) | ||
2257 | goto out; | ||
2258 | } | ||
2259 | |||
2260 | - debug("SF: Successfully erased %zu bytes @ %#x\n", len, start); | ||
2261 | + printf("SF: Successfully erased %zu bytes @ %#x\n", len, start); | ||
2262 | |||
2263 | out: | ||
2264 | spi_release_bus(flash->spi); | ||
2265 | @@ -269,6 +334,73 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr) | ||
2266 | return 0; | ||
2267 | } | ||
2268 | |||
2269 | +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 ear) | ||
2270 | +{ | ||
2271 | + u8 cmd; | ||
2272 | + int ret; | ||
2273 | + | ||
2274 | + ret = spi_flash_cmd_write_enable(flash); | ||
2275 | + if (ret < 0) { | ||
2276 | + debug("SF: enabling write failed\n"); | ||
2277 | + return ret; | ||
2278 | + } | ||
2279 | + | ||
2280 | + cmd = CMD_BANKADDR_BRWR; | ||
2281 | + ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &ear, 1); | ||
2282 | + if (ret) { | ||
2283 | + debug("SF: fail to write bank addr register\n"); | ||
2284 | + return ret; | ||
2285 | + } | ||
2286 | + | ||
2287 | + ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); | ||
2288 | + if (ret < 0) { | ||
2289 | + debug("SF: write config register timed out\n"); | ||
2290 | + return ret; | ||
2291 | + } | ||
2292 | + | ||
2293 | + return 0; | ||
2294 | +} | ||
2295 | + | ||
2296 | +int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data) | ||
2297 | +{ | ||
2298 | + u8 cmd; | ||
2299 | + | ||
2300 | + cmd = CMD_BANKADDR_BRRD; | ||
2301 | + return spi_flash_read_common(flash, &cmd, 1, data, 1); | ||
2302 | +} | ||
2303 | + | ||
2304 | +int spi_flash_bankaddr_access(struct spi_flash *flash, u8 status) | ||
2305 | +{ | ||
2306 | + int ret, pass; | ||
2307 | + u8 data = 0, write_done = 0; | ||
2308 | + | ||
2309 | + for (pass = 0; pass < 2; pass++) { | ||
2310 | + ret = spi_flash_cmd_bankaddr_read(flash, (void *)&data); | ||
2311 | + if (ret < 0) { | ||
2312 | + debug("SF: fail to read bank addr register\n"); | ||
2313 | + return ret; | ||
2314 | + } | ||
2315 | + | ||
2316 | + if ((data != status) & !write_done) { | ||
2317 | + debug("SF: need to %s bank addr bit\n", | ||
2318 | + status ? "set" : "reset"); | ||
2319 | + | ||
2320 | + write_done = 1; | ||
2321 | + ret = spi_flash_cmd_bankaddr_write(flash, status); | ||
2322 | + if (ret < 0) { | ||
2323 | + debug("SF: fail to write bank addr bit\n"); | ||
2324 | + return ret; | ||
2325 | + } | ||
2326 | + } else { | ||
2327 | + debug("SF: bank addr bit is %s.\n", | ||
2328 | + status ? "set" : "reset"); | ||
2329 | + return ret; | ||
2330 | + } | ||
2331 | + } | ||
2332 | + | ||
2333 | + return -1; | ||
2334 | +} | ||
2335 | + | ||
2336 | /* | ||
2337 | * The following table holds all device probe functions | ||
2338 | * | ||
2339 | diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h | ||
2340 | index 141cfa8..dc411e5 100644 | ||
2341 | --- a/drivers/mtd/spi/spi_flash_internal.h | ||
2342 | +++ b/drivers/mtd/spi/spi_flash_internal.h | ||
2343 | @@ -28,8 +28,14 @@ | ||
2344 | #define CMD_ERASE_64K 0xd8 | ||
2345 | #define CMD_ERASE_CHIP 0xc7 | ||
2346 | |||
2347 | +/* Bank addr acess commands */ | ||
2348 | +#define CMD_BANKADDR_BRWR 0x17 | ||
2349 | +#define CMD_BANKADDR_BRRD 0x16 | ||
2350 | + | ||
2351 | /* Common status */ | ||
2352 | #define STATUS_WIP 0x01 | ||
2353 | +#define STATUS_BANKADDR_ENABLE 0x01 | ||
2354 | +#define STATUS_BANKADDR_DISABLE 0x00 | ||
2355 | |||
2356 | /* Send a single-byte command to the device and read the response */ | ||
2357 | int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len); | ||
2358 | @@ -77,6 +83,19 @@ static inline int spi_flash_cmd_write_disable(struct spi_flash *flash) | ||
2359 | /* Program the status register. */ | ||
2360 | int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr); | ||
2361 | |||
2362 | +/* Program the bank address register */ | ||
2363 | +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 ear); | ||
2364 | + | ||
2365 | +/* Read the bank address register */ | ||
2366 | +int spi_flash_cmd_bankaddr_read(struct spi_flash *flash, void *data); | ||
2367 | + | ||
2368 | +/* | ||
2369 | + * Bank address access | ||
2370 | + * access 4th byte address in 3-byte addessing mode for flashes | ||
2371 | + * which has an actual size of > 16MB. | ||
2372 | + */ | ||
2373 | +int spi_flash_bankaddr_access(struct spi_flash *flash, u8 status); | ||
2374 | + | ||
2375 | /* | ||
2376 | * Same as spi_flash_cmd_read() except it also claims/releases the SPI | ||
2377 | * bus. Used as common part of the ->read() operation. | ||
2378 | diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c | ||
2379 | index 30b626a..13c1971 100644 | ||
2380 | --- a/drivers/mtd/spi/stmicro.c | ||
2381 | +++ b/drivers/mtd/spi/stmicro.c | ||
2382 | @@ -93,6 +93,30 @@ static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { | ||
2383 | .name = "M25P128", | ||
2384 | }, | ||
2385 | { | ||
2386 | + .id = 0xba16, | ||
2387 | + .pages_per_sector = 256, | ||
2388 | + .nr_sectors = 64, | ||
2389 | + .name = "N25Q32", | ||
2390 | + }, | ||
2391 | + { | ||
2392 | + .id = 0xbb16, | ||
2393 | + .pages_per_sector = 256, | ||
2394 | + .nr_sectors = 64, | ||
2395 | + .name = "N25Q32A", | ||
2396 | + }, | ||
2397 | + { | ||
2398 | + .id = 0xba17, | ||
2399 | + .pages_per_sector = 256, | ||
2400 | + .nr_sectors = 128, | ||
2401 | + .name = "N25Q64", | ||
2402 | + }, | ||
2403 | + { | ||
2404 | + .id = 0xbb17, | ||
2405 | + .pages_per_sector = 256, | ||
2406 | + .nr_sectors = 128, | ||
2407 | + .name = "N25Q64A", | ||
2408 | + }, | ||
2409 | + { | ||
2410 | .id = 0xba18, | ||
2411 | .pages_per_sector = 256, | ||
2412 | .nr_sectors = 256, | ||
2413 | @@ -110,6 +134,12 @@ static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { | ||
2414 | .nr_sectors = 512, | ||
2415 | .name = "N25Q256", | ||
2416 | }, | ||
2417 | + { | ||
2418 | + .id = 0xbb19, | ||
2419 | + .pages_per_sector = 256, | ||
2420 | + .nr_sectors = 512, | ||
2421 | + .name = "N25Q256A", | ||
2422 | + }, | ||
2423 | }; | ||
2424 | |||
2425 | struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) | ||
2426 | @@ -160,7 +190,15 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) | ||
2427 | flash->read = spi_flash_cmd_read_fast; | ||
2428 | flash->page_size = 256; | ||
2429 | flash->sector_size = 256 * params->pages_per_sector; | ||
2430 | - flash->size = flash->sector_size * params->nr_sectors; | ||
2431 | + | ||
2432 | + /* address width is 4 for dual and 3 for single qspi */ | ||
2433 | + if (flash->spi->is_dual == 1) { | ||
2434 | + flash->addr_width = 4; | ||
2435 | + flash->size = flash->sector_size * (2 * params->nr_sectors); | ||
2436 | + } else { | ||
2437 | + flash->addr_width = 3; | ||
2438 | + flash->size = flash->sector_size * params->nr_sectors; | ||
2439 | + } | ||
2440 | |||
2441 | return flash; | ||
2442 | } | ||
2443 | diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c | ||
2444 | index f6aab3d..3ddd057 100644 | ||
2445 | --- a/drivers/mtd/spi/winbond.c | ||
2446 | +++ b/drivers/mtd/spi/winbond.c | ||
2447 | @@ -67,6 +67,11 @@ static const struct winbond_spi_flash_params winbond_spi_flash_table[] = { | ||
2448 | .nr_blocks = 128, | ||
2449 | .name = "W25Q80", | ||
2450 | }, | ||
2451 | + { | ||
2452 | + .id = 0x6017, | ||
2453 | + .nr_blocks = 128, | ||
2454 | + .name = "W25Q64DW", | ||
2455 | + }, | ||
2456 | }; | ||
2457 | |||
2458 | struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode) | ||
2459 | @@ -101,7 +106,15 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode) | ||
2460 | flash->read = spi_flash_cmd_read_fast; | ||
2461 | flash->page_size = 256; | ||
2462 | flash->sector_size = 4096; | ||
2463 | - flash->size = 4096 * 16 * params->nr_blocks; | ||
2464 | + | ||
2465 | + /* address width is 4 for dual and 3 for single qspi */ | ||
2466 | + if (flash->spi->is_dual == 1) { | ||
2467 | + flash->addr_width = 4; | ||
2468 | + flash->size = 4096 * 16 * (2 * params->nr_blocks); | ||
2469 | + } else { | ||
2470 | + flash->addr_width = 3; | ||
2471 | + flash->size = 4096 * 16 * params->nr_blocks; | ||
2472 | + } | ||
2473 | |||
2474 | return flash; | ||
2475 | } | ||
2476 | diff --git a/drivers/net/Makefile b/drivers/net/Makefile | ||
2477 | index 786a656..0ff814f 100644 | ||
2478 | --- a/drivers/net/Makefile | ||
2479 | +++ b/drivers/net/Makefile | ||
2480 | @@ -77,8 +77,7 @@ COBJS-$(CONFIG_ULI526X) += uli526x.o | ||
2481 | COBJS-$(CONFIG_VSC7385_ENET) += vsc7385.o | ||
2482 | COBJS-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o | ||
2483 | COBJS-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o | ||
2484 | -COBJS-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o xilinx_ll_temac_mdio.o \ | ||
2485 | - xilinx_ll_temac_fifo.o xilinx_ll_temac_sdma.o | ||
2486 | +COBJS-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o | ||
2487 | COBJS-$(CONFIG_ZYNQ_GEM) += zynq_gem.o | ||
2488 | |||
2489 | COBJS := $(sort $(COBJS-y)) | ||
2490 | diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c | ||
2491 | index 4b27198..46801c7 100644 | ||
2492 | --- a/drivers/net/phy/marvell.c | ||
2493 | +++ b/drivers/net/phy/marvell.c | ||
2494 | @@ -465,6 +465,16 @@ static struct phy_driver M88E1149S_driver = { | ||
2495 | .shutdown = &genphy_shutdown, | ||
2496 | }; | ||
2497 | |||
2498 | +static struct phy_driver M88E1518_driver = { | ||
2499 | + .name = "Marvell 88E1518", | ||
2500 | + .uid = 0x1410dd1, | ||
2501 | + .mask = 0xffffff0, | ||
2502 | + .features = PHY_GBIT_FEATURES, | ||
2503 | + .config = &m88e1111s_config, | ||
2504 | + .startup = &m88e1011s_startup, | ||
2505 | + .shutdown = &genphy_shutdown, | ||
2506 | +}; | ||
2507 | + | ||
2508 | int phy_marvell_init(void) | ||
2509 | { | ||
2510 | phy_register(&M88E1149S_driver); | ||
2511 | @@ -474,6 +484,7 @@ int phy_marvell_init(void) | ||
2512 | phy_register(&M88E1118R_driver); | ||
2513 | phy_register(&M88E1111S_driver); | ||
2514 | phy_register(&M88E1011S_driver); | ||
2515 | + phy_register(&M88E1518_driver); | ||
2516 | |||
2517 | return 0; | ||
2518 | } | ||
2519 | diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c | ||
2520 | index d777144..1ff9abf 100644 | ||
2521 | --- a/drivers/net/xilinx_axi_emac.c | ||
2522 | +++ b/drivers/net/xilinx_axi_emac.c | ||
2523 | @@ -30,10 +30,6 @@ | ||
2524 | #include <phy.h> | ||
2525 | #include <miiphy.h> | ||
2526 | |||
2527 | -#if !defined(CONFIG_PHYLIB) | ||
2528 | -# error AXI_ETHERNET requires PHYLIB | ||
2529 | -#endif | ||
2530 | - | ||
2531 | /* Link setup */ | ||
2532 | #define XAE_EMMC_LINKSPEED_MASK 0xC0000000 /* Link speed */ | ||
2533 | #define XAE_EMMC_LINKSPD_10 0x00000000 /* Link Speed mask for 10 Mbit */ | ||
2534 | @@ -234,11 +230,47 @@ static u32 phywrite(struct eth_device *dev, u32 phyaddress, u32 registernum, | ||
2535 | return 0; | ||
2536 | } | ||
2537 | |||
2538 | +static void phy_detection(struct eth_device *dev) | ||
2539 | +{ | ||
2540 | + int i; | ||
2541 | + u16 phyreg; | ||
2542 | + struct axidma_priv *priv = dev->priv; | ||
2543 | + | ||
2544 | + if (priv->phyaddr != -1 ) { | ||
2545 | + phyread(dev, priv->phyaddr, PHY_DETECT_REG, &phyreg); | ||
2546 | + if ((phyreg != 0xFFFF) && | ||
2547 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
2548 | + /* Found a valid PHY address */ | ||
2549 | + debug("Default phy address %d is valid\n", priv->phyaddr); | ||
2550 | + return; | ||
2551 | + } else { | ||
2552 | + debug("PHY address is not setup correctly %d\n", priv->phyaddr); | ||
2553 | + priv->phyaddr = -1; | ||
2554 | + } | ||
2555 | + } | ||
2556 | + | ||
2557 | + debug("detecting phy address\n"); | ||
2558 | + if (priv->phyaddr == -1 ) { | ||
2559 | + /* detect the PHY address */ | ||
2560 | + for (i = 31; i >= 0; i--) { | ||
2561 | + phyread(dev, i, PHY_DETECT_REG, &phyreg); | ||
2562 | + if ((phyreg != 0xFFFF) && | ||
2563 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
2564 | + /* Found a valid PHY address */ | ||
2565 | + priv->phyaddr = i; | ||
2566 | + debug("Found valid phy address, %d\n", i); | ||
2567 | + return; | ||
2568 | + } | ||
2569 | + } | ||
2570 | + } | ||
2571 | + printf("PHY is not detected\n"); | ||
2572 | +} | ||
2573 | + | ||
2574 | /* Setting axi emac and phy to proper setting */ | ||
2575 | static int setup_phy(struct eth_device *dev) | ||
2576 | { | ||
2577 | - u16 phyreg; | ||
2578 | - u32 i, speed, emmc_reg, ret; | ||
2579 | +#ifdef CONFIG_PHYLIB | ||
2580 | + u32 speed, emmc_reg; | ||
2581 | struct axidma_priv *priv = dev->priv; | ||
2582 | struct axi_regs *regs = (struct axi_regs *)dev->iobase; | ||
2583 | struct phy_device *phydev; | ||
2584 | @@ -250,20 +282,7 @@ static int setup_phy(struct eth_device *dev) | ||
2585 | SUPPORTED_1000baseT_Half | | ||
2586 | SUPPORTED_1000baseT_Full; | ||
2587 | |||
2588 | - if (priv->phyaddr == -1) { | ||
2589 | - /* Detect the PHY address */ | ||
2590 | - for (i = 31; i >= 0; i--) { | ||
2591 | - ret = phyread(dev, i, PHY_DETECT_REG, &phyreg); | ||
2592 | - if (!ret && (phyreg != 0xFFFF) && | ||
2593 | - ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
2594 | - /* Found a valid PHY address */ | ||
2595 | - priv->phyaddr = i; | ||
2596 | - debug("axiemac: Found valid phy address, %x\n", | ||
2597 | - phyreg); | ||
2598 | - break; | ||
2599 | - } | ||
2600 | - } | ||
2601 | - } | ||
2602 | + phy_detection(dev); | ||
2603 | |||
2604 | /* Interface - look at tsec */ | ||
2605 | phydev = phy_connect(priv->bus, priv->phyaddr, dev, 0); | ||
2606 | @@ -308,6 +327,65 @@ static int setup_phy(struct eth_device *dev) | ||
2607 | udelay(1); | ||
2608 | |||
2609 | return 1; | ||
2610 | +#else | ||
2611 | + int i; | ||
2612 | + struct axidma_priv *priv = dev->priv; | ||
2613 | + struct axi_regs *regs = (struct axi_regs *)dev->iobase; | ||
2614 | + unsigned retries = 100; | ||
2615 | + u16 phyreg; | ||
2616 | + u32 emmc_reg; | ||
2617 | + | ||
2618 | + | ||
2619 | + debug("waiting for the phy to be up\n"); | ||
2620 | + | ||
2621 | + /* wait for link up and autonegotiation completed */ | ||
2622 | + phyread(dev, priv->phyaddr, PHY_DETECT_REG, &phyreg); | ||
2623 | + while (retries-- && ((phyreg & 0x24) != 0x24)) | ||
2624 | + phyread(dev, priv->phyaddr, PHY_DETECT_REG, &phyreg); | ||
2625 | + | ||
2626 | + phy_detection(dev); | ||
2627 | + | ||
2628 | + /* get PHY id */ | ||
2629 | + phyread(dev, priv->phyaddr, 2, &phyreg); | ||
2630 | + i = phyreg << 16; | ||
2631 | + phyread(dev, priv->phyaddr, 3, &phyreg); | ||
2632 | + i |= phyreg; | ||
2633 | + debug("axiemac: Phy ID 0x%x\n", i); | ||
2634 | + | ||
2635 | + /* Marwell 88e1111 id - ml50x/sp605 */ | ||
2636 | + if (i == 0x1410cc2) { | ||
2637 | + debug("Marvell PHY recognized\n"); | ||
2638 | + | ||
2639 | + /* Setup the emac for the phy speed */ | ||
2640 | + emmc_reg = in_be32(®s->emmc); | ||
2641 | + emmc_reg &= ~XAE_EMMC_LINKSPEED_MASK; | ||
2642 | + | ||
2643 | + phyread(dev, priv->phyaddr, 17, &phyreg); | ||
2644 | + | ||
2645 | + if ((phyreg & 0x8000) == 0x8000) { | ||
2646 | + emmc_reg |= XAE_EMMC_LINKSPD_1000; | ||
2647 | + printf("1000BASE-T\n"); | ||
2648 | + } else if ((phyreg & 0x4000) == 0x4000) { | ||
2649 | + printf("100BASE-T\n"); | ||
2650 | + emmc_reg |= XAE_EMMC_LINKSPD_100; | ||
2651 | + } else { | ||
2652 | + printf("10BASE-T\n"); | ||
2653 | + emmc_reg |= XAE_EMMC_LINKSPD_10; | ||
2654 | + } | ||
2655 | + | ||
2656 | + /* Write new speed setting out to Axi Ethernet */ | ||
2657 | + out_be32(®s->emmc, emmc_reg); | ||
2658 | + | ||
2659 | + /* | ||
2660 | + * Setting the operating speed of the MAC needs a delay. There | ||
2661 | + * doesn't seem to be register to poll, so please consider this | ||
2662 | + * during your application design. | ||
2663 | + */ | ||
2664 | + udelay(1); | ||
2665 | + return 1; | ||
2666 | + } | ||
2667 | + return 0; | ||
2668 | +#endif | ||
2669 | } | ||
2670 | |||
2671 | /* STOP DMA transfers */ | ||
2672 | @@ -400,8 +478,8 @@ static void axi_dma_init(struct eth_device *dev) | ||
2673 | while (timeout--) { | ||
2674 | /* Check transmit/receive channel */ | ||
2675 | /* Reset is done when the reset bit is low */ | ||
2676 | - if (!(in_be32(&priv->dmatx->control) | | ||
2677 | - in_be32(&priv->dmarx->control)) | ||
2678 | + if ((!(in_be32(&priv->dmatx->control) | | ||
2679 | + in_be32(&priv->dmarx->control))) | ||
2680 | & XAXIDMA_CR_RESET_MASK) { | ||
2681 | break; | ||
2682 | } | ||
2683 | @@ -510,7 +588,7 @@ static int axiemac_send(struct eth_device *dev, void *ptr, int len) | ||
2684 | /* Wait for transmission to complete */ | ||
2685 | debug("axiemac: Waiting for tx to be done\n"); | ||
2686 | timeout = 200; | ||
2687 | - while (timeout && (!in_be32(&priv->dmatx->status) & | ||
2688 | + while (timeout && ((!in_be32(&priv->dmatx->status)) & | ||
2689 | (XAXIDMA_IRQ_DELAY_MASK | XAXIDMA_IRQ_IOC_MASK))) { | ||
2690 | timeout--; | ||
2691 | udelay(1); | ||
2692 | diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c | ||
2693 | index d890d60..f78ce0c 100644 | ||
2694 | --- a/drivers/net/xilinx_emaclite.c | ||
2695 | +++ b/drivers/net/xilinx_emaclite.c | ||
2696 | @@ -28,6 +28,8 @@ | ||
2697 | #include <config.h> | ||
2698 | #include <malloc.h> | ||
2699 | #include <asm/io.h> | ||
2700 | +#include <phy.h> | ||
2701 | +#include <miiphy.h> | ||
2702 | #include <fdtdec.h> | ||
2703 | |||
2704 | DECLARE_GLOBAL_DATA_PTR; | ||
2705 | @@ -64,11 +66,37 @@ DECLARE_GLOBAL_DATA_PTR; | ||
2706 | /* Recv interrupt enable bit */ | ||
2707 | #define XEL_RSR_RECV_IE_MASK 0x00000008UL | ||
2708 | |||
2709 | +/* MDIO */ | ||
2710 | +#define XEL_MDIOADDR_OFFSET 0x07E4 /* MDIO Address Register */ | ||
2711 | +#define XEL_MDIOWR_OFFSET 0x07E8 /* MDIO Write Data Register */ | ||
2712 | +#define XEL_MDIORD_OFFSET 0x07EC /* MDIO Read Data Register */ | ||
2713 | +#define XEL_MDIOCTRL_OFFSET 0x07F0 /* MDIO Control Register */ | ||
2714 | + | ||
2715 | +/* MDIO Address Register Bit Masks */ | ||
2716 | +#define XEL_MDIOADDR_REGADR_MASK 0x0000001F /* Register Address */ | ||
2717 | +#define XEL_MDIOADDR_PHYADR_MASK 0x000003E0 /* PHY Address */ | ||
2718 | +#define XEL_MDIOADDR_PHYADR_SHIFT 5 | ||
2719 | +#define XEL_MDIOADDR_OP_MASK 0x00000400 /* RD/WR Operation */ | ||
2720 | + | ||
2721 | +/* MDIO Write Data Register Bit Masks */ | ||
2722 | +#define XEL_MDIOWR_WRDATA_MASK 0x0000FFFF /* Data to be Written */ | ||
2723 | + | ||
2724 | +/* MDIO Read Data Register Bit Masks */ | ||
2725 | +#define XEL_MDIORD_RDDATA_MASK 0x0000FFFF /* Data to be Read */ | ||
2726 | + | ||
2727 | +/* MDIO Control Register Bit Masks */ | ||
2728 | +#define XEL_MDIOCTRL_MDIOSTS_MASK 0x00000001 /* MDIO Status Mask */ | ||
2729 | +#define XEL_MDIOCTRL_MDIOEN_MASK 0x00000008 /* MDIO Enable */ | ||
2730 | + | ||
2731 | struct xemaclite { | ||
2732 | u32 nexttxbuffertouse; /* Next TX buffer to write to */ | ||
2733 | u32 nextrxbuffertouse; /* Next RX buffer to read from */ | ||
2734 | u32 txpp; /* TX ping pong buffer */ | ||
2735 | u32 rxpp; /* RX ping pong buffer */ | ||
2736 | + int phyaddr; | ||
2737 | + | ||
2738 | + struct phy_device *phydev; | ||
2739 | + struct mii_dev *bus; | ||
2740 | }; | ||
2741 | |||
2742 | static u32 etherrxbuff[PKTSIZE_ALIGN/4]; /* Receive buffer */ | ||
2743 | @@ -125,42 +153,181 @@ static void xemaclite_alignedwrite(void *srcptr, u32 destptr, u32 bytecount) | ||
2744 | *to32ptr++ = alignbuffer; | ||
2745 | } | ||
2746 | |||
2747 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
2748 | +static int mdio_wait(struct eth_device *dev) | ||
2749 | +{ | ||
2750 | + u32 timeout = 200; | ||
2751 | + | ||
2752 | + /* Wait till MDIO interface is ready to accept a new transaction. */ | ||
2753 | + while (timeout && in_be32(dev->iobase + XEL_MDIOCTRL_OFFSET) | ||
2754 | + & XEL_MDIOCTRL_MDIOSTS_MASK) | ||
2755 | + timeout--; | ||
2756 | + | ||
2757 | + if (!timeout) { | ||
2758 | + printf("%s: Timeout\n", __func__); | ||
2759 | + return 1; | ||
2760 | + } | ||
2761 | + return 0; | ||
2762 | +} | ||
2763 | + | ||
2764 | +static u32 phyread(struct eth_device *dev, u32 phyaddress, u32 registernum, | ||
2765 | + u16 *data) | ||
2766 | +{ | ||
2767 | + if (mdio_wait(dev)) | ||
2768 | + return 1; | ||
2769 | + | ||
2770 | + u32 ctrl_reg = in_be32(dev->iobase + XEL_MDIOCTRL_OFFSET); | ||
2771 | + out_be32(dev->iobase + XEL_MDIOADDR_OFFSET, | ||
2772 | + XEL_MDIOADDR_OP_MASK | | ||
2773 | + ((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) | registernum)); | ||
2774 | + out_be32(dev->iobase + XEL_MDIOCTRL_OFFSET, | ||
2775 | + ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK); | ||
2776 | + | ||
2777 | + if (mdio_wait(dev)) | ||
2778 | + return 1; | ||
2779 | + | ||
2780 | + /* Read data */ | ||
2781 | + *data = in_be32(dev->iobase + XEL_MDIORD_OFFSET); | ||
2782 | + return 0; | ||
2783 | +} | ||
2784 | + | ||
2785 | +static u32 phywrite(struct eth_device *dev, u32 phyaddress, u32 registernum, | ||
2786 | + u16 data) | ||
2787 | +{ | ||
2788 | + if (mdio_wait(dev)) | ||
2789 | + return 1; | ||
2790 | + | ||
2791 | + /* | ||
2792 | + * Write the PHY address, register number and clear the OP bit in the | ||
2793 | + * MDIO Address register and then write the value into the MDIO Write | ||
2794 | + * Data register. Finally, set the Status bit in the MDIO Control | ||
2795 | + * register to start a MDIO write transaction. | ||
2796 | + */ | ||
2797 | + u32 ctrl_reg = in_be32(dev->iobase + XEL_MDIOCTRL_OFFSET); | ||
2798 | + out_be32(dev->iobase + XEL_MDIOADDR_OFFSET, | ||
2799 | + ~XEL_MDIOADDR_OP_MASK & | ||
2800 | + ((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) | registernum)); | ||
2801 | + out_be32(dev->iobase + XEL_MDIOWR_OFFSET, data); | ||
2802 | + out_be32(dev->iobase + XEL_MDIOCTRL_OFFSET, | ||
2803 | + ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK); | ||
2804 | + | ||
2805 | + if (mdio_wait(dev)) | ||
2806 | + return 1; | ||
2807 | + | ||
2808 | + return 0; | ||
2809 | +} | ||
2810 | +#endif | ||
2811 | + | ||
2812 | static void emaclite_halt(struct eth_device *dev) | ||
2813 | { | ||
2814 | debug("eth_halt\n"); | ||
2815 | } | ||
2816 | |||
2817 | +/* Use MII register 1 (MII status register) to detect PHY */ | ||
2818 | +#define PHY_DETECT_REG 1 | ||
2819 | + | ||
2820 | +/* Mask used to verify certain PHY features (or register contents) | ||
2821 | + * in the register above: | ||
2822 | + * 0x1000: 10Mbps full duplex support | ||
2823 | + * 0x0800: 10Mbps half duplex support | ||
2824 | + * 0x0008: Auto-negotiation support | ||
2825 | + */ | ||
2826 | +#define PHY_DETECT_MASK 0x1808 | ||
2827 | + | ||
2828 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
2829 | +static int setup_phy(struct eth_device *dev) | ||
2830 | +{ | ||
2831 | + int i; | ||
2832 | + u16 phyreg; | ||
2833 | + struct xemaclite *emaclite = dev->priv; | ||
2834 | + struct phy_device *phydev; | ||
2835 | + | ||
2836 | + u32 supported = SUPPORTED_10baseT_Half | | ||
2837 | + SUPPORTED_10baseT_Full | | ||
2838 | + SUPPORTED_100baseT_Half | | ||
2839 | + SUPPORTED_100baseT_Full; | ||
2840 | + | ||
2841 | + if (emaclite->phyaddr != -1 ) { | ||
2842 | + phyread(dev, emaclite->phyaddr, PHY_DETECT_REG, &phyreg); | ||
2843 | + if ((phyreg != 0xFFFF) && | ||
2844 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
2845 | + /* Found a valid PHY address */ | ||
2846 | + debug("Default phy address %d is valid\n", emaclite->phyaddr); | ||
2847 | + } else { | ||
2848 | + debug("PHY address is not setup correctly %d\n", emaclite->phyaddr); | ||
2849 | + emaclite->phyaddr = -1; | ||
2850 | + } | ||
2851 | + } | ||
2852 | + | ||
2853 | + if (emaclite->phyaddr == -1) { | ||
2854 | + /* detect the PHY address */ | ||
2855 | + for (i = 31; i >= 0; i--) { | ||
2856 | + phyread(dev, i, PHY_DETECT_REG, &phyreg); | ||
2857 | + if ((phyreg != 0xFFFF) && | ||
2858 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
2859 | + /* Found a valid PHY address */ | ||
2860 | + emaclite->phyaddr = i; | ||
2861 | + debug("emaclite: Found valid phy address, %d\n", | ||
2862 | + phyreg); | ||
2863 | + break; | ||
2864 | + } | ||
2865 | + } | ||
2866 | + } | ||
2867 | + | ||
2868 | + /* interface - look at tsec */ | ||
2869 | + phydev = phy_connect(emaclite->bus, emaclite->phyaddr, dev, 0); | ||
2870 | + /* | ||
2871 | + * Phy can support 1000baseT but device NOT that's why phydev->supported | ||
2872 | + * must be setup for 1000baseT. phydev->advertising setups what speeds | ||
2873 | + * will be used for autonegotiation where 1000baseT must be disabled. | ||
2874 | + */ | ||
2875 | + phydev->supported = supported | SUPPORTED_1000baseT_Half | | ||
2876 | + SUPPORTED_1000baseT_Full; | ||
2877 | + phydev->advertising = supported; | ||
2878 | + emaclite->phydev = phydev; | ||
2879 | + phy_config(phydev); | ||
2880 | + phy_startup(phydev); | ||
2881 | + | ||
2882 | + /* Do not setup anything */ | ||
2883 | + return 1; | ||
2884 | +} | ||
2885 | +#endif | ||
2886 | + | ||
2887 | static int emaclite_init(struct eth_device *dev, bd_t *bis) | ||
2888 | { | ||
2889 | struct xemaclite *emaclite = dev->priv; | ||
2890 | - debug("EmacLite Initialization Started\n"); | ||
2891 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
2892 | + u32 temp; | ||
2893 | +#endif | ||
2894 | + | ||
2895 | + debug("EmacLite: Initialization Started\n"); | ||
2896 | |||
2897 | /* | ||
2898 | * TX - TX_PING & TX_PONG initialization | ||
2899 | */ | ||
2900 | /* Restart PING TX */ | ||
2901 | - out_be32 (dev->iobase + XEL_TSR_OFFSET, 0); | ||
2902 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET), 0); | ||
2903 | /* Copy MAC address */ | ||
2904 | xemaclite_alignedwrite(dev->enetaddr, dev->iobase, ENET_ADDR_LENGTH); | ||
2905 | /* Set the length */ | ||
2906 | - out_be32 (dev->iobase + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH); | ||
2907 | + out_be32 ((u32 *)(dev->iobase + XEL_TPLR_OFFSET), ENET_ADDR_LENGTH); | ||
2908 | /* Update the MAC address in the EMAC Lite */ | ||
2909 | - out_be32 (dev->iobase + XEL_TSR_OFFSET, XEL_TSR_PROG_MAC_ADDR); | ||
2910 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET), XEL_TSR_PROG_MAC_ADDR); | ||
2911 | /* Wait for EMAC Lite to finish with the MAC address update */ | ||
2912 | - while ((in_be32 (dev->iobase + XEL_TSR_OFFSET) & | ||
2913 | + while ((in_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET)) & | ||
2914 | XEL_TSR_PROG_MAC_ADDR) != 0) | ||
2915 | ; | ||
2916 | |||
2917 | if (emaclite->txpp) { | ||
2918 | /* The same operation with PONG TX */ | ||
2919 | - out_be32 (dev->iobase + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, 0); | ||
2920 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET), 0); | ||
2921 | xemaclite_alignedwrite(dev->enetaddr, dev->iobase + | ||
2922 | XEL_BUFFER_OFFSET, ENET_ADDR_LENGTH); | ||
2923 | - out_be32 (dev->iobase + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH); | ||
2924 | - out_be32 (dev->iobase + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, | ||
2925 | + out_be32 ((u32 *)(dev->iobase + XEL_TPLR_OFFSET), ENET_ADDR_LENGTH); | ||
2926 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET), | ||
2927 | XEL_TSR_PROG_MAC_ADDR); | ||
2928 | - while ((in_be32 (dev->iobase + XEL_TSR_OFFSET + | ||
2929 | - XEL_BUFFER_OFFSET) & XEL_TSR_PROG_MAC_ADDR) != 0) | ||
2930 | + while ((in_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET + | ||
2931 | + XEL_BUFFER_OFFSET)) & XEL_TSR_PROG_MAC_ADDR) != 0) | ||
2932 | ; | ||
2933 | } | ||
2934 | |||
2935 | @@ -168,12 +335,21 @@ static int emaclite_init(struct eth_device *dev, bd_t *bis) | ||
2936 | * RX - RX_PING & RX_PONG initialization | ||
2937 | */ | ||
2938 | /* Write out the value to flush the RX buffer */ | ||
2939 | - out_be32 (dev->iobase + XEL_RSR_OFFSET, XEL_RSR_RECV_IE_MASK); | ||
2940 | + out_be32 ((u32 *)(dev->iobase + XEL_RSR_OFFSET), XEL_RSR_RECV_IE_MASK); | ||
2941 | |||
2942 | if (emaclite->rxpp) | ||
2943 | - out_be32 (dev->iobase + XEL_RSR_OFFSET + XEL_BUFFER_OFFSET, | ||
2944 | + out_be32 ((u32 *)(dev->iobase + XEL_RSR_OFFSET + XEL_BUFFER_OFFSET), | ||
2945 | XEL_RSR_RECV_IE_MASK); | ||
2946 | |||
2947 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
2948 | + /* Enable MII PHY */ | ||
2949 | + /* Enable MII PHY */ | ||
2950 | + out_be32((u32 *)(dev->iobase + XEL_MDIOCTRL_OFFSET), XEL_MDIOCTRL_MDIOEN_MASK); | ||
2951 | + temp = in_be32((u32 *)(dev->iobase + XEL_MDIOCTRL_OFFSET)); | ||
2952 | + if (temp & XEL_MDIOCTRL_MDIOEN_MASK) | ||
2953 | + setup_phy(dev); | ||
2954 | +#endif | ||
2955 | + | ||
2956 | debug("EmacLite Initialization complete\n"); | ||
2957 | return 0; | ||
2958 | } | ||
2959 | @@ -189,13 +365,13 @@ static int xemaclite_txbufferavailable(struct eth_device *dev) | ||
2960 | * Read the other buffer register | ||
2961 | * and determine if the other buffer is available | ||
2962 | */ | ||
2963 | - reg = in_be32 (dev->iobase + | ||
2964 | - emaclite->nexttxbuffertouse + 0); | ||
2965 | + reg = in_be32 ((u32 *)(dev->iobase + | ||
2966 | + emaclite->nexttxbuffertouse + 0)); | ||
2967 | txpingbusy = ((reg & XEL_TSR_XMIT_BUSY_MASK) == | ||
2968 | XEL_TSR_XMIT_BUSY_MASK); | ||
2969 | |||
2970 | - reg = in_be32 (dev->iobase + | ||
2971 | - (emaclite->nexttxbuffertouse ^ XEL_TSR_OFFSET) + 0); | ||
2972 | + reg = in_be32 ((u32 *)(dev->iobase + | ||
2973 | + (emaclite->nexttxbuffertouse ^ XEL_TSR_OFFSET) + 0)); | ||
2974 | txpongbusy = ((reg & XEL_TSR_XMIT_BUSY_MASK) == | ||
2975 | XEL_TSR_XMIT_BUSY_MASK); | ||
2976 | |||
2977 | @@ -221,10 +397,10 @@ static int emaclite_send(struct eth_device *dev, void *ptr, int len) | ||
2978 | if (!maxtry) { | ||
2979 | printf("Error: Timeout waiting for ethernet TX buffer\n"); | ||
2980 | /* Restart PING TX */ | ||
2981 | - out_be32 (dev->iobase + XEL_TSR_OFFSET, 0); | ||
2982 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET), 0); | ||
2983 | if (emaclite->txpp) { | ||
2984 | - out_be32 (dev->iobase + XEL_TSR_OFFSET + | ||
2985 | - XEL_BUFFER_OFFSET, 0); | ||
2986 | + out_be32 ((u32 *)(dev->iobase + XEL_TSR_OFFSET + | ||
2987 | + XEL_BUFFER_OFFSET), 0); | ||
2988 | } | ||
2989 | return -1; | ||
2990 | } | ||
2991 | @@ -233,9 +409,9 @@ static int emaclite_send(struct eth_device *dev, void *ptr, int len) | ||
2992 | baseaddress = (dev->iobase + emaclite->nexttxbuffertouse); | ||
2993 | |||
2994 | /* Determine if the expected buffer address is empty */ | ||
2995 | - reg = in_be32 (baseaddress + XEL_TSR_OFFSET); | ||
2996 | + reg = in_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET)); | ||
2997 | if (((reg & XEL_TSR_XMIT_BUSY_MASK) == 0) | ||
2998 | - && ((in_be32 ((baseaddress) + XEL_TSR_OFFSET) | ||
2999 | + && ((in_be32 (((u32 *)(baseaddress) + XEL_TSR_OFFSET)) | ||
3000 | & XEL_TSR_XMIT_ACTIVE_MASK) == 0)) { | ||
3001 | |||
3002 | if (emaclite->txpp) | ||
3003 | @@ -244,13 +420,13 @@ static int emaclite_send(struct eth_device *dev, void *ptr, int len) | ||
3004 | debug("Send packet from 0x%x\n", baseaddress); | ||
3005 | /* Write the frame to the buffer */ | ||
3006 | xemaclite_alignedwrite(ptr, baseaddress, len); | ||
3007 | - out_be32 (baseaddress + XEL_TPLR_OFFSET,(len & | ||
3008 | + out_be32 ((u32 *)(baseaddress + XEL_TPLR_OFFSET), (len & | ||
3009 | (XEL_TPLR_LENGTH_MASK_HI | XEL_TPLR_LENGTH_MASK_LO))); | ||
3010 | - reg = in_be32 (baseaddress + XEL_TSR_OFFSET); | ||
3011 | + reg = in_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET)); | ||
3012 | reg |= XEL_TSR_XMIT_BUSY_MASK; | ||
3013 | if ((reg & XEL_TSR_XMIT_IE_MASK) != 0) | ||
3014 | reg |= XEL_TSR_XMIT_ACTIVE_MASK; | ||
3015 | - out_be32 (baseaddress + XEL_TSR_OFFSET, reg); | ||
3016 | + out_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET), reg); | ||
3017 | return 0; | ||
3018 | } | ||
3019 | |||
3020 | @@ -258,21 +434,21 @@ static int emaclite_send(struct eth_device *dev, void *ptr, int len) | ||
3021 | /* Switch to second buffer */ | ||
3022 | baseaddress ^= XEL_BUFFER_OFFSET; | ||
3023 | /* Determine if the expected buffer address is empty */ | ||
3024 | - reg = in_be32 (baseaddress + XEL_TSR_OFFSET); | ||
3025 | + reg = in_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET)); | ||
3026 | if (((reg & XEL_TSR_XMIT_BUSY_MASK) == 0) | ||
3027 | - && ((in_be32 ((baseaddress) + XEL_TSR_OFFSET) | ||
3028 | + && ((in_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET)) | ||
3029 | & XEL_TSR_XMIT_ACTIVE_MASK) == 0)) { | ||
3030 | debug("Send packet from 0x%x\n", baseaddress); | ||
3031 | /* Write the frame to the buffer */ | ||
3032 | xemaclite_alignedwrite(ptr, baseaddress, len); | ||
3033 | - out_be32 (baseaddress + XEL_TPLR_OFFSET, (len & | ||
3034 | + out_be32 ((u32 *)(baseaddress + XEL_TPLR_OFFSET), (len & | ||
3035 | (XEL_TPLR_LENGTH_MASK_HI | | ||
3036 | XEL_TPLR_LENGTH_MASK_LO))); | ||
3037 | - reg = in_be32 (baseaddress + XEL_TSR_OFFSET); | ||
3038 | + reg = in_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET)); | ||
3039 | reg |= XEL_TSR_XMIT_BUSY_MASK; | ||
3040 | if ((reg & XEL_TSR_XMIT_IE_MASK) != 0) | ||
3041 | reg |= XEL_TSR_XMIT_ACTIVE_MASK; | ||
3042 | - out_be32 (baseaddress + XEL_TSR_OFFSET, reg); | ||
3043 | + out_be32 ((u32 *)(baseaddress + XEL_TSR_OFFSET), reg); | ||
3044 | return 0; | ||
3045 | } | ||
3046 | } | ||
3047 | @@ -289,7 +465,7 @@ static int emaclite_recv(struct eth_device *dev) | ||
3048 | struct xemaclite *emaclite = dev->priv; | ||
3049 | |||
3050 | baseaddress = dev->iobase + emaclite->nextrxbuffertouse; | ||
3051 | - reg = in_be32 (baseaddress + XEL_RSR_OFFSET); | ||
3052 | + reg = in_be32 ((u32 *)(baseaddress + XEL_RSR_OFFSET)); | ||
3053 | debug("Testing data at address 0x%x\n", baseaddress); | ||
3054 | if ((reg & XEL_RSR_RECV_DONE_MASK) == XEL_RSR_RECV_DONE_MASK) { | ||
3055 | if (emaclite->rxpp) | ||
3056 | @@ -302,7 +478,7 @@ static int emaclite_recv(struct eth_device *dev) | ||
3057 | return 0; | ||
3058 | } else { | ||
3059 | baseaddress ^= XEL_BUFFER_OFFSET; | ||
3060 | - reg = in_be32 (baseaddress + XEL_RSR_OFFSET); | ||
3061 | + reg = in_be32 ((u32 *)(baseaddress + XEL_RSR_OFFSET)); | ||
3062 | if ((reg & XEL_RSR_RECV_DONE_MASK) != | ||
3063 | XEL_RSR_RECV_DONE_MASK) { | ||
3064 | debug("No data was available - address 0x%x\n", | ||
3065 | @@ -312,7 +488,7 @@ static int emaclite_recv(struct eth_device *dev) | ||
3066 | } | ||
3067 | } | ||
3068 | /* Get the length of the frame that arrived */ | ||
3069 | - switch(((ntohl(in_be32 (baseaddress + XEL_RXBUFF_OFFSET + 0xC))) & | ||
3070 | + switch(((ntohl(in_be32 ((u32 *)(baseaddress + XEL_RXBUFF_OFFSET + 0xC)))) & | ||
3071 | 0xFFFF0000 ) >> 16) { | ||
3072 | case 0x806: | ||
3073 | length = 42 + 20; /* FIXME size of ARP */ | ||
3074 | @@ -320,8 +496,8 @@ static int emaclite_recv(struct eth_device *dev) | ||
3075 | break; | ||
3076 | case 0x800: | ||
3077 | length = 14 + 14 + | ||
3078 | - (((ntohl(in_be32 (baseaddress + XEL_RXBUFF_OFFSET + | ||
3079 | - 0x10))) & 0xFFFF0000) >> 16); | ||
3080 | + (((ntohl(in_be32 ((u32 *)(baseaddress + XEL_RXBUFF_OFFSET + | ||
3081 | + 0x10)))) & 0xFFFF0000) >> 16); | ||
3082 | /* FIXME size of IP packet */ | ||
3083 | debug ("IP Packet\n"); | ||
3084 | break; | ||
3085 | @@ -335,9 +511,9 @@ static int emaclite_recv(struct eth_device *dev) | ||
3086 | etherrxbuff, length); | ||
3087 | |||
3088 | /* Acknowledge the frame */ | ||
3089 | - reg = in_be32 (baseaddress + XEL_RSR_OFFSET); | ||
3090 | + reg = in_be32 ((u32 *)(baseaddress + XEL_RSR_OFFSET)); | ||
3091 | reg &= ~XEL_RSR_RECV_DONE_MASK; | ||
3092 | - out_be32 (baseaddress + XEL_RSR_OFFSET, reg); | ||
3093 | + out_be32 ((u32 *)(baseaddress + XEL_RSR_OFFSET), reg); | ||
3094 | |||
3095 | debug("Packet receive from 0x%x, length %dB\n", baseaddress, length); | ||
3096 | NetReceive((uchar *) etherrxbuff, length); | ||
3097 | @@ -345,6 +521,28 @@ static int emaclite_recv(struct eth_device *dev) | ||
3098 | |||
3099 | } | ||
3100 | |||
3101 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
3102 | +static int emaclite_miiphy_read(const char *devname, uchar addr, | ||
3103 | + uchar reg, ushort *val) | ||
3104 | +{ | ||
3105 | + u32 ret; | ||
3106 | + struct eth_device *dev = eth_get_dev(); | ||
3107 | + | ||
3108 | + ret = phyread(dev, addr, reg, val); | ||
3109 | + debug("emaclite: Read MII 0x%x, 0x%x, 0x%x\n", addr, reg, *val); | ||
3110 | + return ret; | ||
3111 | +} | ||
3112 | + | ||
3113 | +static int emaclite_miiphy_write(const char *devname, uchar addr, | ||
3114 | + uchar reg, ushort val) | ||
3115 | +{ | ||
3116 | + struct eth_device *dev = eth_get_dev(); | ||
3117 | + | ||
3118 | + debug("emaclite: Write MII 0x%x, 0x%x, 0x%x\n", addr, reg, val); | ||
3119 | + return phywrite(dev, addr, reg, val); | ||
3120 | +} | ||
3121 | +#endif | ||
3122 | + | ||
3123 | int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, | ||
3124 | int txpp, int rxpp) | ||
3125 | { | ||
3126 | @@ -374,8 +572,19 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, | ||
3127 | dev->send = emaclite_send; | ||
3128 | dev->recv = emaclite_recv; | ||
3129 | |||
3130 | +#ifdef CONFIG_PHY_ADDR | ||
3131 | + emaclite->phyaddr = CONFIG_PHY_ADDR; | ||
3132 | +#else | ||
3133 | + emaclite->phyaddr = -1; | ||
3134 | +#endif | ||
3135 | + | ||
3136 | eth_register(dev); | ||
3137 | |||
3138 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
3139 | + miiphy_register(dev->name, emaclite_miiphy_read, emaclite_miiphy_write); | ||
3140 | + emaclite->bus = miiphy_get_dev_by_name(dev->name); | ||
3141 | +#endif | ||
3142 | + | ||
3143 | return 1; | ||
3144 | } | ||
3145 | |||
3146 | diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c | ||
3147 | index b67153b..5f8fc9c 100644 | ||
3148 | --- a/drivers/net/xilinx_ll_temac.c | ||
3149 | +++ b/drivers/net/xilinx_ll_temac.c | ||
3150 | @@ -1,9 +1,6 @@ | ||
3151 | /* | ||
3152 | * Xilinx xps_ll_temac ethernet driver for u-boot | ||
3153 | * | ||
3154 | - * supports SDMA or FIFO access and MDIO bus communication | ||
3155 | - * | ||
3156 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
3157 | * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
3158 | * Copyright (C) 2008 - 2011 PetaLogix | ||
3159 | * | ||
3160 | @@ -15,391 +12,749 @@ | ||
3161 | * under the terms of the GNU General Public License as published by the | ||
3162 | * Free Software Foundation; either version 2 of the License, or (at your | ||
3163 | * option) any later version. | ||
3164 | - * | ||
3165 | - * [0]: http://www.xilinx.com/support/documentation | ||
3166 | - * | ||
3167 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
3168 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
3169 | */ | ||
3170 | |||
3171 | #include <config.h> | ||
3172 | #include <common.h> | ||
3173 | #include <net.h> | ||
3174 | -#include <netdev.h> | ||
3175 | #include <malloc.h> | ||
3176 | +#include <asm/processor.h> | ||
3177 | #include <asm/io.h> | ||
3178 | +#include <phy.h> | ||
3179 | #include <miiphy.h> | ||
3180 | |||
3181 | -#include "xilinx_ll_temac.h" | ||
3182 | -#include "xilinx_ll_temac_fifo.h" | ||
3183 | -#include "xilinx_ll_temac_sdma.h" | ||
3184 | -#include "xilinx_ll_temac_mdio.h" | ||
3185 | +#undef ETH_HALTING | ||
3186 | + | ||
3187 | +#define XTE_EMMC_LINKSPEED_MASK 0xC0000000 /* Link speed */ | ||
3188 | +/* XTE_EMCFG_LINKSPD_MASK */ | ||
3189 | +#define XTE_EMMC_LINKSPD_10 0x00000000 /* for 10 Mbit */ | ||
3190 | +#define XTE_EMMC_LINKSPD_100 0x40000000 /* for 100 Mbit */ | ||
3191 | +#define XTE_EMMC_LINKSPD_1000 0x80000000 /* forr 1000 Mbit */ | ||
3192 | + | ||
3193 | +#define XTE_RSE_MIIM_RR_MASK 0x0002 | ||
3194 | +#define XTE_RSE_MIIM_WR_MASK 0x0004 | ||
3195 | +#define XTE_RSE_CFG_RR_MASK 0x0020 | ||
3196 | +#define XTE_RSE_CFG_WR_MASK 0x0040 | ||
3197 | + | ||
3198 | +/* XPS_LL_TEMAC indirect registers offset definition */ | ||
3199 | +#define RCW1 0x240 | ||
3200 | +#define TC 0x280 | ||
3201 | +#define EMMC 0x300 | ||
3202 | +#define MC 0x340 | ||
3203 | +#define UAW0 0x380 | ||
3204 | +#define UAW1 0x384 | ||
3205 | +#define AFM 0x390 | ||
3206 | +#define MIIMWD 0x3b0 | ||
3207 | +#define MIIMAI 0x3b4 | ||
3208 | + | ||
3209 | +#define CNTLREG_WRITE_ENABLE_MASK 0x8000 | ||
3210 | + | ||
3211 | +#define MDIO_ENABLE_MASK 0x40 | ||
3212 | +#define MDIO_CLOCK_DIV_100MHz 0x28 | ||
3213 | + | ||
3214 | +/* XPS_LL_TEMAC SDMA registers definition */ | ||
3215 | +#define TX_CURDESC_PTR 0x03 | ||
3216 | +#define TX_TAILDESC_PTR 0x04 | ||
3217 | +#define TX_CHNL_CTRL 0x05 | ||
3218 | +#define TX_IRQ_REG 0x06 | ||
3219 | +#define TX_CHNL_STS 0x07 | ||
3220 | +#define RX_NXTDESC_PTR 0x08 | ||
3221 | +#define RX_CURDESC_PTR 0x0b | ||
3222 | +#define RX_TAILDESC_PTR 0x0c | ||
3223 | +#define RX_CHNL_CTRL 0x0d | ||
3224 | +#define RX_IRQ_REG 0x0e | ||
3225 | +#define RX_CHNL_STS 0x0f | ||
3226 | +#define DMA_CONTROL_REG 0x10 | ||
3227 | + | ||
3228 | +/* DMA control bit */ | ||
3229 | +#define DMA_CONTROL_RESET 0x1 | ||
3230 | + | ||
3231 | +/* CDMAC descriptor status bit definitions */ | ||
3232 | +# define BDSTAT_STOP_ON_END_MASK 0x20 | ||
3233 | +# define BDSTAT_COMPLETED_MASK 0x10 | ||
3234 | +# define BDSTAT_SOP_MASK 0x08 | ||
3235 | +# define BDSTAT_EOP_MASK 0x04 | ||
3236 | + | ||
3237 | +# define CHNL_STS_ERROR_MASK 0x80 | ||
3238 | + | ||
3239 | +/* All interrupt enable bits */ | ||
3240 | +#define XLLDMA_CR_IRQ_ALL_EN_MASK 0x00000087 | ||
3241 | +/* All interrupt bits */ | ||
3242 | +#define XLLDMA_IRQ_ALL_MASK 0x0000001F | ||
3243 | +/* Disable error when 2 or 4 bit coalesce counter overflows */ | ||
3244 | +#define XLLDMA_DMACR_RX_OVERFLOW_ERR_DIS_MASK 0x00000010 | ||
3245 | +/* Disable error when 2 or 4 bit coalesce counter overflows */ | ||
3246 | +#define XLLDMA_DMACR_TX_OVERFLOW_ERR_DIS_MASK 0x00000008 | ||
3247 | +/* Enable use of tail pointer register */ | ||
3248 | +#define XLLDMA_DMACR_TAIL_PTR_EN_MASK 0x00000004 | ||
3249 | + | ||
3250 | +#define LL_FIFO_ISR_RC_COMPLETE 0x04000000 | ||
3251 | + | ||
3252 | +#define SDMA_BIT 1 | ||
3253 | +#define DCR_BIT 2 | ||
3254 | + | ||
3255 | +#define DMAALIGN 32 | ||
3256 | + | ||
3257 | +/* SDMA Buffer Descriptor */ | ||
3258 | +struct cdmac_bd_t { | ||
3259 | + struct cdmac_bd_t *next_p; | ||
3260 | + unsigned char *phys_buf_p; | ||
3261 | + unsigned long buf_len; | ||
3262 | + unsigned char stat; | ||
3263 | + unsigned char app1_1; | ||
3264 | + unsigned short app1_2; | ||
3265 | + unsigned long app2; | ||
3266 | + unsigned long app3; | ||
3267 | + unsigned long app4; | ||
3268 | + unsigned long app5; | ||
3269 | +}; | ||
3270 | + | ||
3271 | +static struct cdmac_bd_t tx_bd __attribute((aligned(DMAALIGN))); | ||
3272 | +static struct cdmac_bd_t rx_bd __attribute((aligned(DMAALIGN))); | ||
3273 | + | ||
3274 | +struct ll_fifo_s { | ||
3275 | + u32 isr; /* Interrupt Status Register 0x0 */ | ||
3276 | + u32 ier; /* Interrupt Enable Register 0x4 */ | ||
3277 | + u32 tdfr; /* Transmit data FIFO reset 0x8 */ | ||
3278 | + u32 tdfv; /* Transmit data FIFO Vacancy 0xC */ | ||
3279 | + u32 tdfd; /* Transmit data FIFO 32bit wide data write port 0x10 */ | ||
3280 | + u32 tlf; /* Write Transmit Length FIFO 0x14 */ | ||
3281 | + u32 rdfr; /* Read Receive data FIFO reset 0x18 */ | ||
3282 | + u32 rdfo; /* Receive data FIFO Occupancy 0x1C */ | ||
3283 | + u32 rdfd; /* Read Receive data FIFO 32bit wide data read port 0x20 */ | ||
3284 | + u32 rlf; /* Read Receive Length FIFO 0x24 */ | ||
3285 | + u32 llr; /* Read LocalLink reset 0x28 */ | ||
3286 | +}; | ||
3287 | + | ||
3288 | +static u8 tx_buffer[PKTSIZE_ALIGN] __attribute((aligned(DMAALIGN))); | ||
3289 | +static u8 rx_buffer[PKTSIZE_ALIGN] __attribute((aligned(DMAALIGN))); | ||
3290 | |||
3291 | -#if !defined(CONFIG_MII) | ||
3292 | -# error "LL_TEMAC requires MII -- missing CONFIG_MII" | ||
3293 | +struct temac_reg { | ||
3294 | + u32 reserved[8]; | ||
3295 | + u32 msw; /* Hard TEMAC MSW Data Register */ | ||
3296 | + u32 lsw; /* Hard TEMAC LSW Data Register */ | ||
3297 | + u32 ctl; /* Hard TEMAC Control Register */ | ||
3298 | + u32 rdy; /* Hard TEMAC Ready Status */ | ||
3299 | +}; | ||
3300 | + | ||
3301 | +struct ll_priv { | ||
3302 | + u32 ctrl; | ||
3303 | + u32 mode; | ||
3304 | + int phyaddr; | ||
3305 | + | ||
3306 | + struct phy_device *phydev; | ||
3307 | + struct mii_dev *bus; | ||
3308 | +}; | ||
3309 | + | ||
3310 | +#define XILINX_INDIRECT_DCR_ADDRESS_REG 0 | ||
3311 | +#define XILINX_INDIRECT_DCR_ACCESS_REG 1 | ||
3312 | + | ||
3313 | +static void mtdcr_local(u32 reg, u32 val) | ||
3314 | +{ | ||
3315 | +#if defined(CONFIG_XILINX_440) | ||
3316 | + mtdcr(XILINX_INDIRECT_DCR_ADDRESS_REG, reg); | ||
3317 | + mtdcr(XILINX_INDIRECT_DCR_ACCESS_REG, val); | ||
3318 | #endif | ||
3319 | +} | ||
3320 | |||
3321 | -#if !defined(CONFIG_PHYLIB) | ||
3322 | -# error "LL_TEMAC requires PHYLIB -- missing CONFIG_PHYLIB" | ||
3323 | +static u32 mfdcr_local(u32 reg) | ||
3324 | +{ | ||
3325 | + u32 val = 0; | ||
3326 | +#if defined(CONFIG_XILINX_440) | ||
3327 | + mtdcr(XILINX_INDIRECT_DCR_ADDRESS_REG, reg); | ||
3328 | + val = mfdcr(XILINX_INDIRECT_DCR_ACCESS_REG); | ||
3329 | #endif | ||
3330 | + return val; | ||
3331 | +} | ||
3332 | |||
3333 | -struct ll_temac_info { | ||
3334 | - int flags; | ||
3335 | - unsigned long base_addr; | ||
3336 | - unsigned long ctrl_addr; | ||
3337 | - char *devname; | ||
3338 | - unsigned int phyaddr; | ||
3339 | - char *mdio_busname; | ||
3340 | -}; | ||
3341 | +static void sdma_out_be32(struct ll_priv *priv, u32 offset, u32 val) | ||
3342 | +{ | ||
3343 | + if (priv->mode & DCR_BIT) | ||
3344 | + mtdcr_local(priv->ctrl + offset, val); | ||
3345 | + else | ||
3346 | + out_be32((u32 *)(priv->ctrl + offset * 4), val); | ||
3347 | +} | ||
3348 | |||
3349 | -/* Ethernet interface ready status */ | ||
3350 | -int ll_temac_check_status(struct temac_reg *regs, u32 mask) | ||
3351 | +static u32 sdma_in_be32(struct ll_priv *priv, u32 offset) | ||
3352 | { | ||
3353 | - unsigned timeout = 50; /* 1usec * 50 = 50usec */ | ||
3354 | + if (priv->mode & DCR_BIT) | ||
3355 | + return mfdcr_local(priv->ctrl + offset); | ||
3356 | + | ||
3357 | + return in_be32((u32 *)(priv->ctrl + offset * 4)); | ||
3358 | +} | ||
3359 | + | ||
3360 | +static void xps_ll_temac_check_status(struct temac_reg *regs, int mask) | ||
3361 | +{ | ||
3362 | + u32 timeout = 2000; | ||
3363 | |||
3364 | - /* | ||
3365 | - * Quote from LL TEMAC documentation: The bits in the RDY | ||
3366 | - * register are asserted when there is no access in progress. | ||
3367 | - * When an access is in progress, a bit corresponding to the | ||
3368 | - * type of access is automatically de-asserted. The bit is | ||
3369 | - * automatically re-asserted when the access is complete. | ||
3370 | - */ | ||
3371 | while (timeout && (!(in_be32(®s->rdy) & mask))) { | ||
3372 | timeout--; | ||
3373 | udelay(1); | ||
3374 | } | ||
3375 | |||
3376 | - if (!timeout) { | ||
3377 | - printf("%s: Timeout on 0x%08x @%p\n", __func__, | ||
3378 | - mask, ®s->rdy); | ||
3379 | - return 1; | ||
3380 | - } | ||
3381 | - | ||
3382 | - return 0; | ||
3383 | + if (!timeout) | ||
3384 | + printf("%s: Timeout\n", __func__); | ||
3385 | } | ||
3386 | |||
3387 | -/* | ||
3388 | - * Indirect write to ll_temac. | ||
3389 | - * | ||
3390 | - * http://www.xilinx.com/support/documentation/ip_documentation/xps_ll_temac.pdf | ||
3391 | - * page 23, second paragraph, The use of CTL0 register or CTL1 register | ||
3392 | - */ | ||
3393 | -int ll_temac_indirect_set(struct temac_reg *regs, u16 regn, u32 reg_data) | ||
3394 | +/* undirect hostif write to ll_temac */ | ||
3395 | +static void xps_ll_temac_hostif_set(struct eth_device *dev, int emac, | ||
3396 | + int phy_addr, int reg_addr, int phy_data) | ||
3397 | { | ||
3398 | - out_be32(®s->lsw, (reg_data & MLSW_MASK)); | ||
3399 | - out_be32(®s->ctl, CTL_WEN | (regn & CTL_ADDR_MASK)); | ||
3400 | - | ||
3401 | - if (ll_temac_check_status(regs, RSE_CFG_WR)) | ||
3402 | - return 0; | ||
3403 | + struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3404 | |||
3405 | - return 1; | ||
3406 | + out_be32(®s->lsw, phy_data); | ||
3407 | + out_be32(®s->ctl, CNTLREG_WRITE_ENABLE_MASK | MIIMWD); | ||
3408 | + out_be32(®s->lsw, (phy_addr << 5) | reg_addr); | ||
3409 | + out_be32(®s->ctl, CNTLREG_WRITE_ENABLE_MASK | MIIMAI | (emac << 10)); | ||
3410 | + xps_ll_temac_check_status(regs, XTE_RSE_MIIM_WR_MASK); | ||
3411 | } | ||
3412 | |||
3413 | -/* | ||
3414 | - * Indirect read from ll_temac. | ||
3415 | - * | ||
3416 | - * http://www.xilinx.com/support/documentation/ip_documentation/xps_ll_temac.pdf | ||
3417 | - * page 23, second paragraph, The use of CTL0 register or CTL1 register | ||
3418 | - */ | ||
3419 | -int ll_temac_indirect_get(struct temac_reg *regs, u16 regn, u32* reg_data) | ||
3420 | +/* undirect hostif read from ll_temac */ | ||
3421 | +static unsigned int xps_ll_temac_hostif_get(struct eth_device *dev, | ||
3422 | + int emac, int phy_addr, int reg_addr) | ||
3423 | { | ||
3424 | - out_be32(®s->ctl, (regn & CTL_ADDR_MASK)); | ||
3425 | + struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3426 | |||
3427 | - if (ll_temac_check_status(regs, RSE_CFG_RR)) | ||
3428 | - return 0; | ||
3429 | + out_be32(®s->lsw, (phy_addr << 5) | reg_addr); | ||
3430 | + out_be32(®s->ctl, MIIMAI | (emac << 10)); | ||
3431 | + xps_ll_temac_check_status(regs, XTE_RSE_MIIM_RR_MASK); | ||
3432 | + return in_be32(®s->lsw); | ||
3433 | +} | ||
3434 | |||
3435 | - *reg_data = in_be32(®s->lsw) & MLSW_MASK; | ||
3436 | - return 1; | ||
3437 | +/* undirect write to ll_temac */ | ||
3438 | +static void xps_ll_temac_indirect_set(struct eth_device *dev, | ||
3439 | + int emac, int reg_offset, int reg_data) | ||
3440 | +{ | ||
3441 | + struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3442 | + | ||
3443 | + out_be32(®s->lsw, reg_data); | ||
3444 | + out_be32(®s->ctl, | ||
3445 | + CNTLREG_WRITE_ENABLE_MASK | (emac << 10) | reg_offset); | ||
3446 | + xps_ll_temac_check_status(regs, XTE_RSE_CFG_WR_MASK); | ||
3447 | } | ||
3448 | |||
3449 | -/* setting sub-controller and ll_temac to proper setting */ | ||
3450 | -static int ll_temac_setup_ctrl(struct eth_device *dev) | ||
3451 | +/* undirect read from ll_temac */ | ||
3452 | +static int xps_ll_temac_indirect_get(struct eth_device *dev, | ||
3453 | + int emac, int reg_offset) | ||
3454 | { | ||
3455 | - struct ll_temac *ll_temac = dev->priv; | ||
3456 | struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3457 | |||
3458 | - if (ll_temac->ctrlreset && ll_temac->ctrlreset(dev)) | ||
3459 | - return 0; | ||
3460 | + out_be32(®s->ctl, (emac << 10) | reg_offset); | ||
3461 | + xps_ll_temac_check_status(regs, XTE_RSE_CFG_RR_MASK); | ||
3462 | + return in_be32(®s->lsw); | ||
3463 | +} | ||
3464 | |||
3465 | - if (ll_temac->ctrlinit && ll_temac->ctrlinit(dev)) | ||
3466 | - return 0; | ||
3467 | +#ifdef DEBUG | ||
3468 | +/* read from phy */ | ||
3469 | +static void read_phy_reg(struct eth_device *dev, int phy_addr) | ||
3470 | +{ | ||
3471 | + int j, result; | ||
3472 | |||
3473 | - /* Promiscuous mode disable */ | ||
3474 | - if (!ll_temac_indirect_set(regs, TEMAC_AFM, 0)) | ||
3475 | - return 0; | ||
3476 | + debug("phy%d ", phy_addr); | ||
3477 | + for (j = 0; j < 32; j++) { | ||
3478 | + result = xps_ll_temac_hostif_get(dev, 0, phy_addr, j); | ||
3479 | + debug("%d: 0x%x ", j, result); | ||
3480 | + } | ||
3481 | + debug("\n"); | ||
3482 | +} | ||
3483 | +#endif | ||
3484 | |||
3485 | - /* Enable Receiver - RX bit */ | ||
3486 | - if (!ll_temac_indirect_set(regs, TEMAC_RCW1, RCW1_RX)) | ||
3487 | - return 0; | ||
3488 | +static void phy_detection(struct eth_device *dev) | ||
3489 | +{ | ||
3490 | |||
3491 | - /* Enable Transmitter - TX bit */ | ||
3492 | - if (!ll_temac_indirect_set(regs, TEMAC_TC, TC_TX)) | ||
3493 | - return 0; | ||
3494 | + int i; | ||
3495 | + struct ll_priv *priv = dev->priv; | ||
3496 | + unsigned int phyreg = 0; | ||
3497 | |||
3498 | - return 1; | ||
3499 | + | ||
3500 | + if (priv->phyaddr != -1 ) { | ||
3501 | + phyreg = xps_ll_temac_hostif_get(dev, 0, priv->phyaddr, 1); | ||
3502 | + if ((phyreg & 0x0ffff) != 0x0ffff) { | ||
3503 | + /* Found a valid PHY address */ | ||
3504 | + debug("Default phy address %d is valid\n", priv->phyaddr); | ||
3505 | + } else { | ||
3506 | + debug("PHY address is not setup correctly %d\n", priv->phyaddr); | ||
3507 | + priv->phyaddr = -1; | ||
3508 | + } | ||
3509 | + } | ||
3510 | + | ||
3511 | + /* try out if have ever found the right phy? */ | ||
3512 | + if (priv->phyaddr == -1) { | ||
3513 | + for (i = 31; i >= 0; i--) { | ||
3514 | + phyreg = xps_ll_temac_hostif_get(dev, 0, i, 1); | ||
3515 | + if ((phyreg & 0x0ffff) != 0x0ffff) { | ||
3516 | + debug("phy %x result %x\n", i, phyreg); | ||
3517 | + priv->phyaddr = i; | ||
3518 | + break; | ||
3519 | + } | ||
3520 | + } | ||
3521 | + } | ||
3522 | } | ||
3523 | |||
3524 | -/* | ||
3525 | - * Configure ll_temac based on negotiated speed and duplex | ||
3526 | - * reported by PHY handling code | ||
3527 | - */ | ||
3528 | -static int ll_temac_adjust_link(struct eth_device *dev) | ||
3529 | +/* setting ll_temac and phy to proper setting */ | ||
3530 | +static int xps_ll_temac_phy_ctrl(struct eth_device *dev) | ||
3531 | { | ||
3532 | - unsigned int speed, emmc_reg; | ||
3533 | - struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3534 | - struct ll_temac *ll_temac = dev->priv; | ||
3535 | - struct phy_device *phydev = ll_temac->phydev; | ||
3536 | +#ifdef CONFIG_PHYLIB | ||
3537 | + unsigned int temp, speed; | ||
3538 | + struct ll_priv *priv = dev->priv; | ||
3539 | + struct phy_device *phydev; | ||
3540 | |||
3541 | - if (!phydev->link) { | ||
3542 | - printf("%s: No link.\n", phydev->dev->name); | ||
3543 | - return 0; | ||
3544 | - } | ||
3545 | + u32 supported = SUPPORTED_10baseT_Half | | ||
3546 | + SUPPORTED_10baseT_Full | | ||
3547 | + SUPPORTED_100baseT_Half | | ||
3548 | + SUPPORTED_100baseT_Full | | ||
3549 | + SUPPORTED_1000baseT_Half | | ||
3550 | + SUPPORTED_1000baseT_Full; | ||
3551 | + | ||
3552 | + phy_detection(dev); | ||
3553 | + | ||
3554 | + /* interface - look at tsec */ | ||
3555 | + phydev = phy_connect(priv->bus, priv->phyaddr, dev, 0); | ||
3556 | + | ||
3557 | + phydev->supported &= supported; | ||
3558 | + phydev->advertising = phydev->supported; | ||
3559 | + priv->phydev = phydev; | ||
3560 | + phy_config(phydev); | ||
3561 | + phy_startup(phydev); | ||
3562 | |||
3563 | switch (phydev->speed) { | ||
3564 | case 1000: | ||
3565 | - speed = EMMC_LSPD_1000; | ||
3566 | + speed = XTE_EMMC_LINKSPD_1000; | ||
3567 | break; | ||
3568 | case 100: | ||
3569 | - speed = EMMC_LSPD_100; | ||
3570 | + speed = XTE_EMMC_LINKSPD_100; | ||
3571 | break; | ||
3572 | case 10: | ||
3573 | - speed = EMMC_LSPD_10; | ||
3574 | + speed = XTE_EMMC_LINKSPD_10; | ||
3575 | break; | ||
3576 | default: | ||
3577 | return 0; | ||
3578 | } | ||
3579 | |||
3580 | - if (!ll_temac_indirect_get(regs, TEMAC_EMMC, &emmc_reg)) | ||
3581 | - return 0; | ||
3582 | + temp = xps_ll_temac_indirect_get(dev, 0, EMMC); | ||
3583 | + temp &= ~XTE_EMMC_LINKSPEED_MASK; | ||
3584 | + temp |= speed; | ||
3585 | + xps_ll_temac_indirect_set(dev, 0, EMMC, temp); | ||
3586 | + | ||
3587 | + return 1; | ||
3588 | |||
3589 | - emmc_reg &= ~EMMC_LSPD_MASK; | ||
3590 | - emmc_reg |= speed; | ||
3591 | +#else | ||
3592 | + int i; | ||
3593 | + unsigned int result; | ||
3594 | + struct ll_priv *priv = dev->priv; | ||
3595 | + unsigned retries = 10; | ||
3596 | + unsigned int phyreg = 0; | ||
3597 | |||
3598 | - if (!ll_temac_indirect_set(regs, TEMAC_EMMC, emmc_reg)) | ||
3599 | - return 0; | ||
3600 | + phy_detection(dev); | ||
3601 | |||
3602 | - printf("%s: PHY is %s with %dbase%s, %s%s\n", | ||
3603 | - dev->name, phydev->drv->name, | ||
3604 | - phydev->speed, (phydev->port == PORT_TP) ? "T" : "X", | ||
3605 | - (phydev->duplex) ? "FDX" : "HDX", | ||
3606 | - (phydev->port == PORT_OTHER) ? ", unkown mode" : ""); | ||
3607 | +#ifdef DEBUG | ||
3608 | + read_phy_reg(dev, priv->phyaddr); | ||
3609 | +#endif | ||
3610 | + | ||
3611 | + /* wait for link up */ | ||
3612 | + puts("Waiting for link ... "); | ||
3613 | + retries = 20000; | ||
3614 | + while (retries-- && | ||
3615 | + ((xps_ll_temac_hostif_get(dev, 0, priv->phyaddr, 1) | ||
3616 | + & 0x04) != 0x04)) { | ||
3617 | + udelay(100); | ||
3618 | + } | ||
3619 | + | ||
3620 | + phyreg = xps_ll_temac_indirect_get(dev, 0, EMMC) & | ||
3621 | + (~XTE_EMMC_LINKSPEED_MASK); | ||
3622 | + | ||
3623 | + /* get PHY id */ | ||
3624 | + i = (xps_ll_temac_hostif_get(dev, 0, priv->phyaddr, 2) << 16) | | ||
3625 | + xps_ll_temac_hostif_get(dev, 0, priv->phyaddr, 3); | ||
3626 | + debug("LL_TEMAC: Phy ID 0x%x\n", i); | ||
3627 | + | ||
3628 | + /* FIXME this part will be replaced by PHY lib */ | ||
3629 | + /* s3e boards */ | ||
3630 | + if (i == 0x7c0a3) { | ||
3631 | + /* 100BASE-T/FD */ | ||
3632 | + xps_ll_temac_indirect_set(dev, 0, EMMC, | ||
3633 | + (phyreg | XTE_EMMC_LINKSPD_100)); | ||
3634 | + return 1; | ||
3635 | + } | ||
3636 | + | ||
3637 | +#if 0 | ||
3638 | + /* Support for Xilinx 1000BASE-X PCS/PMA core */ | ||
3639 | + if (i == 0x0) { | ||
3640 | + /* 1000BASE-X/FD */ | ||
3641 | + xps_ll_temac_indirect_set(dev, 0, EMMC, 0x80000000); | ||
3642 | + /* Clear the Isolate bit from PHY control register */ | ||
3643 | + xps_ll_temac_hostif_set(dev, 0, phy_addr, 0, 0x1140); | ||
3644 | + link = 1; | ||
3645 | + return 1; | ||
3646 | + } | ||
3647 | +#endif | ||
3648 | + | ||
3649 | + result = xps_ll_temac_hostif_get(dev, 0, priv->phyaddr, 5); | ||
3650 | + if ((result & 0x8000) == 0x8000) { | ||
3651 | + xps_ll_temac_indirect_set(dev, 0, EMMC, | ||
3652 | + (phyreg | XTE_EMMC_LINKSPD_1000)); | ||
3653 | + printf("1000BASE-T/FD\n"); | ||
3654 | + } else if ((result & 0x4000) == 0x4000) { | ||
3655 | + xps_ll_temac_indirect_set(dev, 0, EMMC, | ||
3656 | + (phyreg | XTE_EMMC_LINKSPD_100)); | ||
3657 | + printf("100BASE-T/FD\n"); | ||
3658 | + } else { | ||
3659 | + /* unsupported mode or auto-negotiation failed */ | ||
3660 | + puts("Unsupported mode or auto-negotiation failed\n"); | ||
3661 | + } | ||
3662 | |||
3663 | return 1; | ||
3664 | +#endif | ||
3665 | +} | ||
3666 | + | ||
3667 | +static inline int xps_ll_temac_dma_error(struct eth_device *dev) | ||
3668 | +{ | ||
3669 | + int err; | ||
3670 | + struct ll_priv *priv = dev->priv; | ||
3671 | + | ||
3672 | + /* Check for TX and RX channel errrors. */ | ||
3673 | + err = sdma_in_be32(priv, TX_CHNL_STS) & CHNL_STS_ERROR_MASK; | ||
3674 | + err |= sdma_in_be32(priv, RX_CHNL_STS) & CHNL_STS_ERROR_MASK; | ||
3675 | + return err; | ||
3676 | +} | ||
3677 | + | ||
3678 | +static void xps_ll_temac_reset_dma(struct eth_device *dev) | ||
3679 | +{ | ||
3680 | + u32 r; | ||
3681 | + struct ll_priv *priv = dev->priv; | ||
3682 | + | ||
3683 | + /* Soft reset the DMA. */ | ||
3684 | + sdma_out_be32(priv, DMA_CONTROL_REG, DMA_CONTROL_RESET); | ||
3685 | + while (sdma_in_be32(priv, DMA_CONTROL_REG) & DMA_CONTROL_RESET) | ||
3686 | + ; | ||
3687 | + | ||
3688 | + /* Now clear the interrupts. */ | ||
3689 | + r = sdma_in_be32(priv, TX_CHNL_CTRL); | ||
3690 | + r &= ~XLLDMA_CR_IRQ_ALL_EN_MASK; | ||
3691 | + sdma_out_be32(priv, TX_CHNL_CTRL, r); | ||
3692 | + | ||
3693 | + r = sdma_in_be32(priv, RX_CHNL_CTRL); | ||
3694 | + r &= ~XLLDMA_CR_IRQ_ALL_EN_MASK; | ||
3695 | + sdma_out_be32(priv, RX_CHNL_CTRL, r); | ||
3696 | + | ||
3697 | + /* Now ACK pending IRQs. */ | ||
3698 | + sdma_out_be32(priv, TX_IRQ_REG, XLLDMA_IRQ_ALL_MASK); | ||
3699 | + sdma_out_be32(priv, RX_IRQ_REG, XLLDMA_IRQ_ALL_MASK); | ||
3700 | + | ||
3701 | + /* Set tail-ptr mode, disable errors for both channels. */ | ||
3702 | + sdma_out_be32(priv, DMA_CONTROL_REG, | ||
3703 | + XLLDMA_DMACR_TAIL_PTR_EN_MASK | | ||
3704 | + XLLDMA_DMACR_RX_OVERFLOW_ERR_DIS_MASK | | ||
3705 | + XLLDMA_DMACR_TX_OVERFLOW_ERR_DIS_MASK); | ||
3706 | +} | ||
3707 | + | ||
3708 | +/* bd init */ | ||
3709 | +static void xps_ll_temac_bd_init(struct eth_device *dev) | ||
3710 | +{ | ||
3711 | + struct ll_priv *priv = dev->priv; | ||
3712 | + | ||
3713 | + memset(&tx_bd, 0, sizeof(tx_bd)); | ||
3714 | + memset(&rx_bd, 0, sizeof(rx_bd)); | ||
3715 | + | ||
3716 | + rx_bd.phys_buf_p = rx_buffer; | ||
3717 | + rx_bd.next_p = &rx_bd; | ||
3718 | + rx_bd.buf_len = PKTSIZE_ALIGN; | ||
3719 | + flush_cache((u32)&rx_bd, sizeof(tx_bd)); | ||
3720 | + flush_cache((u32)rx_bd.phys_buf_p, PKTSIZE_ALIGN); | ||
3721 | + | ||
3722 | + sdma_out_be32(priv, RX_CURDESC_PTR, (u32)&rx_bd); | ||
3723 | + sdma_out_be32(priv, RX_TAILDESC_PTR, (u32)&rx_bd); | ||
3724 | + sdma_out_be32(priv, RX_NXTDESC_PTR, (u32)&rx_bd); /* setup first fd */ | ||
3725 | + | ||
3726 | + tx_bd.phys_buf_p = tx_buffer; | ||
3727 | + tx_bd.next_p = &tx_bd; | ||
3728 | + | ||
3729 | + flush_cache((u32)&tx_bd, sizeof(tx_bd)); | ||
3730 | + sdma_out_be32(priv, TX_CURDESC_PTR, (u32)&tx_bd); | ||
3731 | +} | ||
3732 | + | ||
3733 | +static int ll_temac_send_sdma(struct eth_device *dev, | ||
3734 | + void *buffer, int length) | ||
3735 | +{ | ||
3736 | + struct ll_priv *priv = dev->priv; | ||
3737 | + | ||
3738 | + if (xps_ll_temac_dma_error(dev)) { | ||
3739 | + xps_ll_temac_reset_dma(dev); | ||
3740 | + xps_ll_temac_bd_init(dev); | ||
3741 | + } | ||
3742 | + | ||
3743 | + memcpy(tx_buffer, (void *)buffer, length); | ||
3744 | + flush_cache((u32)tx_buffer, length); | ||
3745 | + | ||
3746 | + tx_bd.stat = BDSTAT_SOP_MASK | BDSTAT_EOP_MASK | | ||
3747 | + BDSTAT_STOP_ON_END_MASK; | ||
3748 | + tx_bd.buf_len = length; | ||
3749 | + flush_cache((u32)&tx_bd, sizeof(tx_bd)); | ||
3750 | + | ||
3751 | + sdma_out_be32(priv, TX_CURDESC_PTR, (u32)&tx_bd); | ||
3752 | + sdma_out_be32(priv, TX_TAILDESC_PTR, (u32)&tx_bd); /* DMA start */ | ||
3753 | + | ||
3754 | + do { | ||
3755 | + flush_cache((u32)&tx_bd, sizeof(tx_bd)); | ||
3756 | + } while (!(tx_bd.stat & BDSTAT_COMPLETED_MASK)); | ||
3757 | + | ||
3758 | + return 0; | ||
3759 | +} | ||
3760 | + | ||
3761 | +static int ll_temac_recv_sdma(struct eth_device *dev) | ||
3762 | +{ | ||
3763 | + int length; | ||
3764 | + struct ll_priv *priv = dev->priv; | ||
3765 | + | ||
3766 | + if (xps_ll_temac_dma_error(dev)) { | ||
3767 | + xps_ll_temac_reset_dma(dev); | ||
3768 | + xps_ll_temac_bd_init(dev); | ||
3769 | + } | ||
3770 | + | ||
3771 | + flush_cache((u32)&rx_bd, sizeof(rx_bd)); | ||
3772 | + | ||
3773 | + if (!(rx_bd.stat & BDSTAT_COMPLETED_MASK)) | ||
3774 | + return 0; | ||
3775 | + | ||
3776 | + /* | ||
3777 | + * Read out the packet info and start the DMA | ||
3778 | + * onto the second buffer to enable the ethernet rx | ||
3779 | + * path to run in parallel with sw processing | ||
3780 | + * packets. | ||
3781 | + */ | ||
3782 | + length = rx_bd.app5 & 0x3FFF; /* max length mask */ | ||
3783 | + if (length > 0) | ||
3784 | + NetReceive(rx_bd.phys_buf_p, length); | ||
3785 | + | ||
3786 | + /* flip the buffer and re-enable the DMA. */ | ||
3787 | + flush_cache((u32)rx_bd.phys_buf_p, length); | ||
3788 | + | ||
3789 | + rx_bd.buf_len = PKTSIZE_ALIGN; | ||
3790 | + rx_bd.stat = 0; | ||
3791 | + rx_bd.app5 = 0; | ||
3792 | + | ||
3793 | + flush_cache((u32)&rx_bd, sizeof(rx_bd)); | ||
3794 | + sdma_out_be32(priv, RX_TAILDESC_PTR, (u32)&rx_bd); | ||
3795 | + | ||
3796 | + return length; | ||
3797 | +} | ||
3798 | + | ||
3799 | +#ifdef DEBUG | ||
3800 | +static void debugll(struct eth_device *dev, int count) | ||
3801 | +{ | ||
3802 | + struct ll_priv *priv = dev->priv; | ||
3803 | + struct ll_fifo_s *ll_fifo = (void *)priv->ctrl; | ||
3804 | + | ||
3805 | + printf("%d fifo isr 0x%08x, fifo_ier 0x%08x, fifo_rdfr 0x%08x, " | ||
3806 | + "fifo_rdfo 0x%08x fifo_rlr 0x%08x\n", count, | ||
3807 | + in_be32(&ll_fifo->isr), in_be32(&ll_fifo->ier), | ||
3808 | + in_be32(&ll_fifo->rdfr), in_be32(&ll_fifo->rdfo), | ||
3809 | + in_be32(&ll_fifo->rlf)); | ||
3810 | +} | ||
3811 | +#endif | ||
3812 | + | ||
3813 | +static int ll_temac_send_fifo(struct eth_device *dev, | ||
3814 | + void *buffer, int length) | ||
3815 | +{ | ||
3816 | + struct ll_priv *priv = dev->priv; | ||
3817 | + struct ll_fifo_s *ll_fifo = (void *)priv->ctrl; | ||
3818 | + u32 *buf = (u32 *)buffer; | ||
3819 | + u32 i; | ||
3820 | + | ||
3821 | + for (i = 0; i < length; i += 4) | ||
3822 | + out_be32(&ll_fifo->tdfd, *buf++); | ||
3823 | + | ||
3824 | + out_be32(&ll_fifo->tlf, length); | ||
3825 | + return 0; | ||
3826 | +} | ||
3827 | + | ||
3828 | +static int ll_temac_recv_fifo(struct eth_device *dev) | ||
3829 | +{ | ||
3830 | + struct ll_priv *priv = dev->priv; | ||
3831 | + struct ll_fifo_s *ll_fifo = (void *)priv->ctrl; | ||
3832 | + u32 i, len = 0; | ||
3833 | + u32 *buf = (u32 *)&rx_buffer; | ||
3834 | + | ||
3835 | + if (in_be32(&ll_fifo->isr) & LL_FIFO_ISR_RC_COMPLETE) { | ||
3836 | + out_be32(&ll_fifo->isr, 0xffffffff); /* reset isr */ | ||
3837 | + | ||
3838 | + len = in_be32(&ll_fifo->rlf) & 0x7FF; | ||
3839 | + | ||
3840 | + for (i = 0; i < len; i += 4) | ||
3841 | + *buf++ = in_be32(&ll_fifo->rdfd); | ||
3842 | + | ||
3843 | +#ifdef DEBUG | ||
3844 | + debugll(dev, 1); | ||
3845 | +#endif | ||
3846 | + NetReceive((uchar *)&rx_buffer, len); | ||
3847 | + } | ||
3848 | + return len; | ||
3849 | } | ||
3850 | |||
3851 | /* setup mac addr */ | ||
3852 | -static int ll_temac_setup_mac_addr(struct eth_device *dev) | ||
3853 | +static int ll_temac_addr_setup(struct eth_device *dev) | ||
3854 | { | ||
3855 | - struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3856 | - u32 val; | ||
3857 | + int val; | ||
3858 | |||
3859 | /* set up unicast MAC address filter */ | ||
3860 | val = ((dev->enetaddr[3] << 24) | (dev->enetaddr[2] << 16) | | ||
3861 | - (dev->enetaddr[1] << 8) | (dev->enetaddr[0])); | ||
3862 | - val &= UAW0_UADDR_MASK; | ||
3863 | + (dev->enetaddr[1] << 8) | (dev->enetaddr[0])); | ||
3864 | + xps_ll_temac_indirect_set(dev, 0, UAW0, val); | ||
3865 | + val = (dev->enetaddr[5] << 8) | dev->enetaddr[4] ; | ||
3866 | + xps_ll_temac_indirect_set(dev, 0, UAW1, val); | ||
3867 | |||
3868 | - if (!ll_temac_indirect_set(regs, TEMAC_UAW0, val)) | ||
3869 | - return 1; | ||
3870 | + return 0; | ||
3871 | +} | ||
3872 | |||
3873 | - val = ((dev->enetaddr[5] << 8) | dev->enetaddr[4]); | ||
3874 | - val &= UAW1_UADDR_MASK; | ||
3875 | +static int xps_ll_temac_init(struct eth_device *dev, bd_t *bis) | ||
3876 | +{ | ||
3877 | + struct ll_priv *priv = dev->priv; | ||
3878 | + struct ll_fifo_s *ll_fifo = (void *)priv->ctrl; | ||
3879 | |||
3880 | - if (!ll_temac_indirect_set(regs, TEMAC_UAW1, val)) | ||
3881 | - return 1; | ||
3882 | + if (priv->mode & SDMA_BIT) { | ||
3883 | + xps_ll_temac_reset_dma(dev); | ||
3884 | + xps_ll_temac_bd_init(dev); | ||
3885 | + } else { | ||
3886 | + out_be32(&ll_fifo->tdfr, 0x000000a5); /* Fifo reset key */ | ||
3887 | + out_be32(&ll_fifo->rdfr, 0x000000a5); /* Fifo reset key */ | ||
3888 | + out_be32(&ll_fifo->isr, 0xFFFFFFFF); /* Reset status register */ | ||
3889 | + out_be32(&ll_fifo->ier, 0); /* Disable all IRQs */ | ||
3890 | + } | ||
3891 | |||
3892 | + xps_ll_temac_indirect_set(dev, 0, MC, | ||
3893 | + MDIO_ENABLE_MASK | MDIO_CLOCK_DIV_100MHz); | ||
3894 | + | ||
3895 | + /* Promiscuous mode disable */ | ||
3896 | + xps_ll_temac_indirect_set(dev, 0, AFM, 0); | ||
3897 | + /* Enable Receiver - RX bit */ | ||
3898 | + xps_ll_temac_indirect_set(dev, 0, RCW1, 0x10000000); | ||
3899 | + /* Enable Transmitter - TX bit */ | ||
3900 | + xps_ll_temac_indirect_set(dev, 0, TC, 0x10000000); | ||
3901 | return 0; | ||
3902 | } | ||
3903 | |||
3904 | /* halt device */ | ||
3905 | static void ll_temac_halt(struct eth_device *dev) | ||
3906 | { | ||
3907 | - struct ll_temac *ll_temac = dev->priv; | ||
3908 | - struct temac_reg *regs = (struct temac_reg *)dev->iobase; | ||
3909 | +#ifdef ETH_HALTING | ||
3910 | + struct ll_priv *priv = dev->priv; | ||
3911 | |||
3912 | /* Disable Receiver */ | ||
3913 | - ll_temac_indirect_set(regs, TEMAC_RCW0, 0); | ||
3914 | - | ||
3915 | + xps_ll_temac_indirect_set(dev, 0, RCW1, 0); | ||
3916 | /* Disable Transmitter */ | ||
3917 | - ll_temac_indirect_set(regs, TEMAC_TC, 0); | ||
3918 | - | ||
3919 | - if (ll_temac->ctrlhalt) | ||
3920 | - ll_temac->ctrlhalt(dev); | ||
3921 | + xps_ll_temac_indirect_set(dev, 0, TC, 0); | ||
3922 | |||
3923 | - /* Shut down the PHY, as needed */ | ||
3924 | - phy_shutdown(ll_temac->phydev); | ||
3925 | + if (priv->mode & SDMA_BIT) { | ||
3926 | + sdma_out_be32(priv->ctrl, DMA_CONTROL_REG, DMA_CONTROL_RESET); | ||
3927 | + while (sdma_in_be32(priv->ctrl, DMA_CONTROL_REG) | ||
3928 | + & DMA_CONTROL_RESET) | ||
3929 | + ; | ||
3930 | + } | ||
3931 | +#endif | ||
3932 | } | ||
3933 | |||
3934 | static int ll_temac_init(struct eth_device *dev, bd_t *bis) | ||
3935 | { | ||
3936 | - struct ll_temac *ll_temac = dev->priv; | ||
3937 | - int ret; | ||
3938 | +#if DEBUG | ||
3939 | + int i; | ||
3940 | +#endif | ||
3941 | + xps_ll_temac_init(dev, bis); | ||
3942 | |||
3943 | printf("%s: Xilinx XPS LocalLink Tri-Mode Ether MAC #%d at 0x%08X.\n", | ||
3944 | - dev->name, dev->index, dev->iobase); | ||
3945 | - | ||
3946 | - if (!ll_temac_setup_ctrl(dev)) | ||
3947 | - return -1; | ||
3948 | + dev->name, 0, dev->iobase); | ||
3949 | |||
3950 | - /* Start up the PHY */ | ||
3951 | - ret = phy_startup(ll_temac->phydev); | ||
3952 | - if (ret) { | ||
3953 | - printf("%s: Could not initialize PHY %s\n", | ||
3954 | - dev->name, ll_temac->phydev->dev->name); | ||
3955 | - return ret; | ||
3956 | - } | ||
3957 | +#if DEBUG | ||
3958 | + for (i = 0; i < 32; i++) | ||
3959 | + read_phy_reg(dev, i); | ||
3960 | +#endif | ||
3961 | |||
3962 | - if (!ll_temac_adjust_link(dev)) { | ||
3963 | + if (!xps_ll_temac_phy_ctrl(dev)) { | ||
3964 | ll_temac_halt(dev); | ||
3965 | return -1; | ||
3966 | } | ||
3967 | |||
3968 | - /* If there's no link, fail */ | ||
3969 | - return ll_temac->phydev->link ? 0 : -1; | ||
3970 | + return 0; | ||
3971 | } | ||
3972 | |||
3973 | -/* | ||
3974 | - * Discover which PHY is attached to the device, and configure it | ||
3975 | - * properly. If the PHY is not recognized, then return 0 | ||
3976 | - * (failure). Otherwise, return 1 | ||
3977 | - */ | ||
3978 | -static int ll_temac_phy_init(struct eth_device *dev) | ||
3979 | +static int ll_temac_miiphy_read(const char *devname, uchar addr, | ||
3980 | + uchar reg, ushort *val) | ||
3981 | { | ||
3982 | - struct ll_temac *ll_temac = dev->priv; | ||
3983 | - struct phy_device *phydev; | ||
3984 | - unsigned int supported = PHY_GBIT_FEATURES; | ||
3985 | + struct eth_device *dev = eth_get_dev(); | ||
3986 | |||
3987 | - /* interface - look at driver/net/tsec.c */ | ||
3988 | - phydev = phy_connect(ll_temac->bus, ll_temac->phyaddr, | ||
3989 | - dev, PHY_INTERFACE_MODE_NONE); | ||
3990 | + *val = xps_ll_temac_hostif_get(dev, 0, addr, reg); /* emac = 0 */ | ||
3991 | |||
3992 | - phydev->supported &= supported; | ||
3993 | - phydev->advertising = phydev->supported; | ||
3994 | + debug("%s 0x%x, 0x%x, 0x%x\n", __func__, addr, reg, *val); | ||
3995 | + return 0; | ||
3996 | +} | ||
3997 | |||
3998 | - ll_temac->phydev = phydev; | ||
3999 | +static int ll_temac_miiphy_write(const char *devname, uchar addr, | ||
4000 | + uchar reg, ushort val) | ||
4001 | +{ | ||
4002 | + struct eth_device *dev = eth_get_dev(); | ||
4003 | |||
4004 | - phy_config(phydev); | ||
4005 | + debug("%s 0x%x, 0x%x, 0x%x\n", __func__, addr, reg, val); | ||
4006 | |||
4007 | - return 1; | ||
4008 | + xps_ll_temac_hostif_set(dev, 0, addr, reg, val); | ||
4009 | + | ||
4010 | + return 0; | ||
4011 | } | ||
4012 | |||
4013 | -/* | ||
4014 | - * Initialize a single ll_temac devices | ||
4015 | - * | ||
4016 | - * Returns the result of ll_temac phy interface that were initialized | ||
4017 | - */ | ||
4018 | -int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf) | ||
4019 | +static int ll_temac_bus_reset(struct mii_dev *bus) | ||
4020 | +{ | ||
4021 | + debug("Just bus reset\n"); | ||
4022 | + return 0; | ||
4023 | +} | ||
4024 | + | ||
4025 | +/* mode bits: 0bit - fifo(0)/sdma(1):SDMA_BIT, 1bit - no dcr(0)/dcr(1):DCR_BIT | ||
4026 | + * ctrl - control address for file/sdma */ | ||
4027 | +int xilinx_ll_temac_initialize(bd_t *bis, unsigned long base_addr, | ||
4028 | + int mode, unsigned long ctrl) | ||
4029 | { | ||
4030 | struct eth_device *dev; | ||
4031 | - struct ll_temac *ll_temac; | ||
4032 | + struct ll_priv *priv; | ||
4033 | |||
4034 | dev = calloc(1, sizeof(*dev)); | ||
4035 | if (dev == NULL) | ||
4036 | - return 0; | ||
4037 | + return -1; | ||
4038 | |||
4039 | - ll_temac = calloc(1, sizeof(struct ll_temac)); | ||
4040 | - if (ll_temac == NULL) { | ||
4041 | + dev->priv = calloc(1, sizeof(struct ll_priv)); | ||
4042 | + if (dev->priv == NULL) { | ||
4043 | free(dev); | ||
4044 | - return 0; | ||
4045 | + return -1; | ||
4046 | } | ||
4047 | |||
4048 | - /* use given name or generate its own unique name */ | ||
4049 | - if (devinf->devname) { | ||
4050 | - strncpy(dev->name, devinf->devname, sizeof(dev->name)); | ||
4051 | - } else { | ||
4052 | - snprintf(dev->name, sizeof(dev->name), "lltemac.%lx", devinf->base_addr); | ||
4053 | - devinf->devname = dev->name; | ||
4054 | - } | ||
4055 | + priv = dev->priv; | ||
4056 | |||
4057 | - dev->iobase = devinf->base_addr; | ||
4058 | + sprintf(dev->name, "Xlltem.%lx", base_addr); | ||
4059 | + | ||
4060 | + dev->iobase = base_addr; | ||
4061 | + priv->ctrl = ctrl; | ||
4062 | + priv->mode = mode; | ||
4063 | + | ||
4064 | +#ifdef CONFIG_PHY_ADDR | ||
4065 | + priv->phyaddr = CONFIG_PHY_ADDR; | ||
4066 | +#else | ||
4067 | + priv->phyaddr = -1; | ||
4068 | +#endif | ||
4069 | |||
4070 | - dev->priv = ll_temac; | ||
4071 | dev->init = ll_temac_init; | ||
4072 | dev->halt = ll_temac_halt; | ||
4073 | - dev->write_hwaddr = ll_temac_setup_mac_addr; | ||
4074 | - | ||
4075 | - ll_temac->ctrladdr = devinf->ctrl_addr; | ||
4076 | - if (devinf->flags & XILINX_LL_TEMAC_M_SDMA_PLB) { | ||
4077 | -#if defined(CONFIG_XILINX_440) || defined(CONFIG_XILINX_405) | ||
4078 | - if (devinf->flags & XILINX_LL_TEMAC_M_SDMA_DCR) { | ||
4079 | - ll_temac_collect_xldcr_sdma_reg_addr(dev); | ||
4080 | - ll_temac->in32 = ll_temac_xldcr_in32; | ||
4081 | - ll_temac->out32 = ll_temac_xldcr_out32; | ||
4082 | - } else | ||
4083 | -#endif | ||
4084 | - { | ||
4085 | - ll_temac_collect_xlplb_sdma_reg_addr(dev); | ||
4086 | - ll_temac->in32 = ll_temac_xlplb_in32; | ||
4087 | - ll_temac->out32 = ll_temac_xlplb_out32; | ||
4088 | - } | ||
4089 | - ll_temac->ctrlinit = ll_temac_init_sdma; | ||
4090 | - ll_temac->ctrlhalt = ll_temac_halt_sdma; | ||
4091 | - ll_temac->ctrlreset = ll_temac_reset_sdma; | ||
4092 | - dev->recv = ll_temac_recv_sdma; | ||
4093 | + dev->write_hwaddr = ll_temac_addr_setup; | ||
4094 | + | ||
4095 | + if (priv->mode & SDMA_BIT) { | ||
4096 | dev->send = ll_temac_send_sdma; | ||
4097 | + dev->recv = ll_temac_recv_sdma; | ||
4098 | } else { | ||
4099 | - ll_temac->in32 = NULL; | ||
4100 | - ll_temac->out32 = NULL; | ||
4101 | - ll_temac->ctrlinit = NULL; | ||
4102 | - ll_temac->ctrlhalt = NULL; | ||
4103 | - ll_temac->ctrlreset = ll_temac_reset_fifo; | ||
4104 | - dev->recv = ll_temac_recv_fifo; | ||
4105 | dev->send = ll_temac_send_fifo; | ||
4106 | + dev->recv = ll_temac_recv_fifo; | ||
4107 | } | ||
4108 | |||
4109 | - /* Link to specified MDIO bus */ | ||
4110 | - strncpy(ll_temac->mdio_busname, devinf->mdio_busname, MDIO_NAME_LEN); | ||
4111 | - ll_temac->bus = miiphy_get_dev_by_name(ll_temac->mdio_busname); | ||
4112 | - | ||
4113 | - /* Looking for a valid PHY address if it is not yet set */ | ||
4114 | - if (devinf->phyaddr == -1) | ||
4115 | - ll_temac->phyaddr = ll_temac_phy_addr(ll_temac->bus); | ||
4116 | - else | ||
4117 | - ll_temac->phyaddr = devinf->phyaddr; | ||
4118 | - | ||
4119 | eth_register(dev); | ||
4120 | |||
4121 | - /* Try to initialize PHY here, and return */ | ||
4122 | - return ll_temac_phy_init(dev); | ||
4123 | -} | ||
4124 | - | ||
4125 | -/* | ||
4126 | - * Initialize a single ll_temac device with its mdio bus behind ll_temac | ||
4127 | - * | ||
4128 | - * Returns 1 if the ll_temac device and the mdio bus were initialized | ||
4129 | - * otherwise returns 0 | ||
4130 | - */ | ||
4131 | -int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags, | ||
4132 | - unsigned long ctrl_addr) | ||
4133 | -{ | ||
4134 | - struct ll_temac_info devinf; | ||
4135 | - struct ll_temac_mdio_info mdioinf; | ||
4136 | - int ret; | ||
4137 | - | ||
4138 | - /* prepare the internal driver informations */ | ||
4139 | - devinf.flags = flags; | ||
4140 | - devinf.base_addr = base_addr; | ||
4141 | - devinf.ctrl_addr = ctrl_addr; | ||
4142 | - devinf.devname = NULL; | ||
4143 | - devinf.phyaddr = -1; | ||
4144 | - | ||
4145 | - mdioinf.name = devinf.mdio_busname = NULL; | ||
4146 | - mdioinf.regs = (struct temac_reg *)devinf.base_addr; | ||
4147 | - | ||
4148 | - ret = xilinx_ll_temac_mdio_initialize(bis, &mdioinf); | ||
4149 | - if (ret >= 0) { | ||
4150 | - | ||
4151 | - /* | ||
4152 | - * If there was no MDIO bus name then take over the | ||
4153 | - * new automaticaly generated by the MDIO init code. | ||
4154 | - */ | ||
4155 | - if (mdioinf.name != devinf.mdio_busname) | ||
4156 | - devinf.mdio_busname = mdioinf.name; | ||
4157 | - | ||
4158 | - ret = xilinx_ll_temac_initialize(bis, &devinf); | ||
4159 | - if (ret > 0) | ||
4160 | - return 1; | ||
4161 | - | ||
4162 | - } | ||
4163 | - | ||
4164 | - return 0; | ||
4165 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
4166 | + miiphy_register(dev->name, ll_temac_miiphy_read, ll_temac_miiphy_write); | ||
4167 | + priv->bus = miiphy_get_dev_by_name(dev->name); | ||
4168 | + priv->bus->reset = ll_temac_bus_reset; | ||
4169 | +#endif | ||
4170 | + return 1; | ||
4171 | } | ||
4172 | diff --git a/drivers/net/xilinx_ll_temac.h b/drivers/net/xilinx_ll_temac.h | ||
4173 | deleted file mode 100644 | ||
4174 | index ece3b60..0000000 | ||
4175 | --- a/drivers/net/xilinx_ll_temac.h | ||
4176 | +++ /dev/null | ||
4177 | @@ -1,310 +0,0 @@ | ||
4178 | -/* | ||
4179 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
4180 | - * | ||
4181 | - * LL_TEMAC interface | ||
4182 | - * | ||
4183 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
4184 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
4185 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
4186 | - * | ||
4187 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
4188 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
4189 | - * March 2008 created | ||
4190 | - * | ||
4191 | - * This program is free software; you can redistribute it and/or modify it | ||
4192 | - * under the terms of the GNU General Public License as published by the | ||
4193 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
4194 | - * option) any later version. | ||
4195 | - * | ||
4196 | - * [0]: http://www.xilinx.com/support/documentation | ||
4197 | - * | ||
4198 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4199 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
4200 | - */ | ||
4201 | -#ifndef _XILINX_LL_TEMAC_ | ||
4202 | -#define _XILINX_LL_TEMAC_ | ||
4203 | - | ||
4204 | -#include <config.h> | ||
4205 | -#include <net.h> | ||
4206 | -#include <phy.h> | ||
4207 | -#include <miiphy.h> | ||
4208 | - | ||
4209 | -#include <asm/types.h> | ||
4210 | -#include <asm/byteorder.h> | ||
4211 | - | ||
4212 | -#include "xilinx_ll_temac_sdma.h" | ||
4213 | - | ||
4214 | -#if !defined(__BIG_ENDIAN) | ||
4215 | -# error LL_TEMAC requires big endianess | ||
4216 | -#endif | ||
4217 | - | ||
4218 | -/* | ||
4219 | - * TEMAC Memory and Register Definition | ||
4220 | - * | ||
4221 | - * [1]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4222 | - * page 19, Memory and Register Descriptions | ||
4223 | - */ | ||
4224 | -struct temac_reg { | ||
4225 | - /* direct soft registers (low part) */ | ||
4226 | - u32 raf; /* Reset and Address Filter */ | ||
4227 | - u32 tpf; /* Transmit Pause Frame */ | ||
4228 | - u32 ifgp; /* Transmit Inter Frame Gap Adjustment */ | ||
4229 | - u32 is; /* Interrupt Status */ | ||
4230 | - u32 ip; /* Interrupt Pending */ | ||
4231 | - u32 ie; /* Interrupt Enable */ | ||
4232 | - u32 ttag; /* Transmit VLAN Tag */ | ||
4233 | - u32 rtag; /* Receive VLAN Tag */ | ||
4234 | - /* hard TEMAC registers */ | ||
4235 | - u32 msw; /* Most Significant Word Data */ | ||
4236 | - u32 lsw; /* Least Significant Word Data */ | ||
4237 | - u32 ctl; /* Control */ | ||
4238 | - u32 rdy; /* Ready Status */ | ||
4239 | - /* direct soft registers (high part) */ | ||
4240 | - u32 uawl; /* Unicast Address Word Lower */ | ||
4241 | - u32 uawu; /* Unicast Address Word Upper */ | ||
4242 | - u32 tpid0; /* VLAN TPID Word 0 */ | ||
4243 | - u32 tpid1; /* VLAN TPID Word 1 */ | ||
4244 | -}; | ||
4245 | - | ||
4246 | -/* Reset and Address Filter Registers (raf), [1] p25 */ | ||
4247 | -#define RAF_SR (1 << 13) | ||
4248 | -#define RAF_EMFE (1 << 12) | ||
4249 | -#define RAF_NFE (1 << 11) | ||
4250 | -#define RAF_RVSTM_POS 9 | ||
4251 | -#define RAF_RVSTM_MASK (3 << RAF_RVSTM_POS) | ||
4252 | -#define RAF_TVSTM_POS 7 | ||
4253 | -#define RAF_TVSTM_MASK (3 << RAF_TVSTM_POS) | ||
4254 | -#define RAF_RVTM_POS 5 | ||
4255 | -#define RAF_RVTM_MASK (3 << RAF_RVTM_POS) | ||
4256 | -#define RAF_TVTM_POS 3 | ||
4257 | -#define RAF_TVTM_MASK (3 << RAF_TVTM_POS) | ||
4258 | -#define RAF_BCREJ (1 << 2) | ||
4259 | -#define RAF_MCREJ (1 << 1) | ||
4260 | -#define RAF_HTRST (1 << 0) | ||
4261 | - | ||
4262 | -/* Transmit Pause Frame Registers (tpf), [1] p28 */ | ||
4263 | -#define TPF_TPFV_POS 0 | ||
4264 | -#define TPF_TPFV_MASK (0xFFFF << TPF_TPFV_POS) | ||
4265 | - | ||
4266 | -/* Transmit Inter Frame Gap Adjustment Registers (ifgp), [1] p28 */ | ||
4267 | -#define IFGP_POS 0 | ||
4268 | -#define IFGP_MASK (0xFF << IFGP_POS) | ||
4269 | - | ||
4270 | -/* Interrupt Status, Pending, Enable Registers (is, ip, ie), [1] p29-33 */ | ||
4271 | -#define ISPE_MR (1 << 7) | ||
4272 | -#define ISPE_RDL (1 << 6) | ||
4273 | -#define ISPE_TC (1 << 5) | ||
4274 | -#define ISPE_RFO (1 << 4) | ||
4275 | -#define ISPE_RR (1 << 3) | ||
4276 | -#define ISPE_RC (1 << 2) | ||
4277 | -#define ISPE_AN (1 << 1) | ||
4278 | -#define ISPE_HAC (1 << 0) | ||
4279 | - | ||
4280 | -/* Transmit, Receive VLAN Tag Registers (ttag, rtag), [1] p34-35 */ | ||
4281 | -#define TRTAG_TPID_POS 16 | ||
4282 | -#define TRTAG_TPID_MASK (0xFFFF << TRTAG_TPID_POS) | ||
4283 | -#define TRTAG_PRIO_POS 13 | ||
4284 | -#define TRTAG_PRIO_MASK (7 << TRTAG_PRIO_POS) | ||
4285 | -#define TRTAG_CFI (1 << 12) | ||
4286 | -#define TRTAG_VID_POS 0 | ||
4287 | -#define TRTAG_VID_MASK (0xFFF << TRTAG_VID_POS) | ||
4288 | - | ||
4289 | -/* Most, Least Significant Word Data Register (msw, lsw), [1] p46 */ | ||
4290 | -#define MLSW_POS 0 | ||
4291 | -#define MLSW_MASK (~0UL << MLSW_POS) | ||
4292 | - | ||
4293 | -/* LSW Data Register for PHY addresses (lsw), [1] p66 */ | ||
4294 | -#define LSW_REGAD_POS 0 | ||
4295 | -#define LSW_REGAD_MASK (0x1F << LSW_REGAD_POS) | ||
4296 | -#define LSW_PHYAD_POS 5 | ||
4297 | -#define LSW_PHYAD_MASK (0x1F << LSW_PHYAD_POS) | ||
4298 | - | ||
4299 | -/* LSW Data Register for PHY data (lsw), [1] p66 */ | ||
4300 | -#define LSW_REGDAT_POS 0 | ||
4301 | -#define LSW_REGDAT_MASK (0xFFFF << LSW_REGDAT_POS) | ||
4302 | - | ||
4303 | -/* Control Register (ctl), [1] p47 */ | ||
4304 | -#define CTL_WEN (1 << 15) | ||
4305 | -#define CTL_ADDR_POS 0 | ||
4306 | -#define CTL_ADDR_MASK (0x3FF << CTL_ADDR_POS) | ||
4307 | - | ||
4308 | -/* Ready Status Register Ethernet (rdy), [1] p48 */ | ||
4309 | -#define RSE_HACS_RDY (1 << 14) | ||
4310 | -#define RSE_CFG_WR (1 << 6) | ||
4311 | -#define RSE_CFG_RR (1 << 5) | ||
4312 | -#define RSE_AF_WR (1 << 4) | ||
4313 | -#define RSE_AF_RR (1 << 3) | ||
4314 | -#define RSE_MIIM_WR (1 << 2) | ||
4315 | -#define RSE_MIIM_RR (1 << 1) | ||
4316 | -#define RSE_FABR_RR (1 << 0) | ||
4317 | - | ||
4318 | -/* Unicast Address Word Lower, Upper Registers (uawl, uawu), [1] p35-36 */ | ||
4319 | -#define UAWL_UADDR_POS 0 | ||
4320 | -#define UAWL_UADDR_MASK (~0UL << UAWL_UADDR_POS) | ||
4321 | -#define UAWU_UADDR_POS 0 | ||
4322 | -#define UAWU_UADDR_MASK (0xFFFF << UAWU_UADDR_POS) | ||
4323 | - | ||
4324 | -/* VLAN TPID Word 0, 1 Registers (tpid0, tpid1), [1] p37 */ | ||
4325 | -#define TPID0_V0_POS 0 | ||
4326 | -#define TPID0_V0_MASK (0xFFFF << TPID0_V0_POS) | ||
4327 | -#define TPID0_V1_POS 16 | ||
4328 | -#define TPID0_V1_MASK (0xFFFF << TPID0_V1_POS) | ||
4329 | -#define TPID1_V2_POS 0 | ||
4330 | -#define TPID1_V2_MASK (0xFFFF << TPID1_V2_POS) | ||
4331 | -#define TPID1_V3_POS 16 | ||
4332 | -#define TPID1_V3_MASK (0xFFFF << TPID1_V3_POS) | ||
4333 | - | ||
4334 | -/* | ||
4335 | - * TEMAC Indirectly Addressable Register Index Enumeration | ||
4336 | - * | ||
4337 | - * [0]: http://www.xilinx.com/support/documentation | ||
4338 | - * | ||
4339 | - * [1]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4340 | - * page 23, PLB Indirectly Addressable TEMAC Registers | ||
4341 | - */ | ||
4342 | -enum temac_ctrl { | ||
4343 | - TEMAC_RCW0 = 0x200, | ||
4344 | - TEMAC_RCW1 = 0x240, | ||
4345 | - TEMAC_TC = 0x280, | ||
4346 | - TEMAC_FCC = 0x2C0, | ||
4347 | - TEMAC_EMMC = 0x300, | ||
4348 | - TEMAC_PHYC = 0x320, | ||
4349 | - TEMAC_MC = 0x340, | ||
4350 | - TEMAC_UAW0 = 0x380, | ||
4351 | - TEMAC_UAW1 = 0x384, | ||
4352 | - TEMAC_MAW0 = 0x388, | ||
4353 | - TEMAC_MAW1 = 0x38C, | ||
4354 | - TEMAC_AFM = 0x390, | ||
4355 | - TEMAC_TIS = 0x3A0, | ||
4356 | - TEMAC_TIE = 0x3A4, | ||
4357 | - TEMAC_MIIMWD = 0x3B0, | ||
4358 | - TEMAC_MIIMAI = 0x3B4 | ||
4359 | -}; | ||
4360 | - | ||
4361 | -/* Receive Configuration Word 0, 1 Registers (RCW0, RCW1), [1] p50-51 */ | ||
4362 | -#define RCW0_PADDR_POS 0 | ||
4363 | -#define RCW0_PADDR_MASK (~0UL << RCW_PADDR_POS) | ||
4364 | -#define RCW1_RST (1 << 31) | ||
4365 | -#define RCW1_JUM (1 << 30) | ||
4366 | -#define RCW1_FCS (1 << 29) | ||
4367 | -#define RCW1_RX (1 << 28) | ||
4368 | -#define RCW1_VLAN (1 << 27) | ||
4369 | -#define RCW1_HD (1 << 26) | ||
4370 | -#define RCW1_LT_DIS (1 << 25) | ||
4371 | -#define RCW1_PADDR_POS 0 | ||
4372 | -#define RCW1_PADDR_MASK (0xFFFF << RCW_PADDR_POS) | ||
4373 | - | ||
4374 | -/* Transmit Configuration Registers (TC), [1] p52 */ | ||
4375 | -#define TC_RST (1 << 31) | ||
4376 | -#define TC_JUM (1 << 30) | ||
4377 | -#define TC_FCS (1 << 29) | ||
4378 | -#define TC_TX (1 << 28) | ||
4379 | -#define TC_VLAN (1 << 27) | ||
4380 | -#define TC_HD (1 << 26) | ||
4381 | -#define TC_IFG (1 << 25) | ||
4382 | - | ||
4383 | -/* Flow Control Configuration Registers (FCC), [1] p54 */ | ||
4384 | -#define FCC_FCTX (1 << 30) | ||
4385 | -#define FCC_FCRX (1 << 29) | ||
4386 | - | ||
4387 | -/* Ethernet MAC Mode Configuration Registers (EMMC), [1] p54 */ | ||
4388 | -#define EMMC_LSPD_POS 30 | ||
4389 | -#define EMMC_LSPD_MASK (3 << EMMC_LSPD_POS) | ||
4390 | -#define EMMC_LSPD_1000 (2 << EMMC_LSPD_POS) | ||
4391 | -#define EMMC_LSPD_100 (1 << EMMC_LSPD_POS) | ||
4392 | -#define EMMC_LSPD_10 0 | ||
4393 | -#define EMMC_RGMII (1 << 29) | ||
4394 | -#define EMMC_SGMII (1 << 28) | ||
4395 | -#define EMMC_GPCS (1 << 27) | ||
4396 | -#define EMMC_HOST (1 << 26) | ||
4397 | -#define EMMC_TX16 (1 << 25) | ||
4398 | -#define EMMC_RX16 (1 << 24) | ||
4399 | - | ||
4400 | -/* RGMII/SGMII Configuration Registers (PHYC), [1] p56 */ | ||
4401 | -#define PHYC_SLSPD_POS 30 | ||
4402 | -#define PHYC_SLSPD_MASK (3 << EMMC_SLSPD_POS) | ||
4403 | -#define PHYC_SLSPD_1000 (2 << EMMC_SLSPD_POS) | ||
4404 | -#define PHYC_SLSPD_100 (1 << EMMC_SLSPD_POS) | ||
4405 | -#define PHYC_SLSPD_10 0 | ||
4406 | -#define PHYC_RLSPD_POS 2 | ||
4407 | -#define PHYC_RLSPD_MASK (3 << EMMC_RLSPD_POS) | ||
4408 | -#define PHYC_RLSPD_1000 (2 << EMMC_RLSPD_POS) | ||
4409 | -#define PHYC_RLSPD_100 (1 << EMMC_RLSPD_POS) | ||
4410 | -#define PHYC_RLSPD_10 0 | ||
4411 | -#define PHYC_RGMII_HD (1 << 1) | ||
4412 | -#define PHYC_RGMII_LINK (1 << 0) | ||
4413 | - | ||
4414 | -/* Management Configuration Registers (MC), [1] p57 */ | ||
4415 | -#define MC_MDIOEN (1 << 6) | ||
4416 | -#define MC_CLKDIV_POS 0 | ||
4417 | -#define MC_CLKDIV_MASK (0x3F << MC_CLKDIV_POS) | ||
4418 | - | ||
4419 | -/* | ||
4420 | - * fHOSTCLK fMDC = fHOSTCLK | ||
4421 | - * fMDC = ------------------- ---------> MC_CLKDIV = -------- - 1 | ||
4422 | - * (1 + MC_CLKDIV) * 2 2.5 MHz 5MHz | ||
4423 | - */ | ||
4424 | -#define MC_CLKDIV(f, m) ((f / (2 * m)) - 1) | ||
4425 | -#define MC_CLKDIV_25(f) MC_CLKDIV(f, 2500000) | ||
4426 | -#define MC_CLKDIV_20(f) MC_CLKDIV(f, 2000000) | ||
4427 | -#define MC_CLKDIV_15(f) MC_CLKDIV(f, 1500000) | ||
4428 | -#define MC_CLKDIV_10(f) MC_CLKDIV(f, 1000000) | ||
4429 | - | ||
4430 | -/* Unicast Address Word 0, 1 Registers (UAW0, UAW1), [1] p58-59 */ | ||
4431 | -#define UAW0_UADDR_POS 0 | ||
4432 | -#define UAW0_UADDR_MASK (~0UL << UAW0_UADDR_POS) | ||
4433 | -#define UAW1_UADDR_POS 0 | ||
4434 | -#define UAW1_UADDR_MASK (0xFFFF << UAW1_UADDR_POS) | ||
4435 | - | ||
4436 | -/* Multicast Address Word 0, 1 Registers (MAW0, MAW1), [1] p60 */ | ||
4437 | -#define MAW0_MADDR_POS 0 | ||
4438 | -#define MAW0_MADDR_MASK (~0UL << MAW0_MADDR_POS) | ||
4439 | -#define MAW1_RNW (1 << 23) | ||
4440 | -#define MAW1_MAIDX_POS 16 | ||
4441 | -#define MAW1_MAIDX_MASK (3 << MAW1_MAIDX_POS) | ||
4442 | -#define MAW1_MADDR_POS 0 | ||
4443 | -#define MAW1_MADDR_MASK (0xFFFF << MAW1_MADDR_POS) | ||
4444 | - | ||
4445 | -/* Address Filter Mode Registers (AFM), [1] p63 */ | ||
4446 | -#define AFM_PM (1 << 31) | ||
4447 | - | ||
4448 | -/* Interrupt Status, Enable Registers (TIS, TIE), [1] p63-65 */ | ||
4449 | -#define TISE_CFG_W (1 << 6) | ||
4450 | -#define TISE_CFG_R (1 << 5) | ||
4451 | -#define TISE_AF_W (1 << 4) | ||
4452 | -#define TISE_AF_R (1 << 3) | ||
4453 | -#define TISE_MIIM_W (1 << 2) | ||
4454 | -#define TISE_MIIM_R (1 << 1) | ||
4455 | -#define TISE_FABR_R (1 << 0) | ||
4456 | - | ||
4457 | -/* MII Management Write Data Registers (MIIMWD), [1] p66 */ | ||
4458 | -#define MIIMWD_DATA_POS 0 | ||
4459 | -#define MIIMWD_DATA_MASK (0xFFFF << MIIMWD_DATA_POS) | ||
4460 | - | ||
4461 | -/* Ethernet interface ready status */ | ||
4462 | -int ll_temac_check_status(struct temac_reg *regs, u32 mask); | ||
4463 | - | ||
4464 | -/* Indirect write to ll_temac. */ | ||
4465 | -int ll_temac_indirect_set(struct temac_reg *regs, u16 regn, u32 reg_data); | ||
4466 | - | ||
4467 | -/* Indirect read from ll_temac. */ | ||
4468 | -int ll_temac_indirect_get(struct temac_reg *regs, u16 regn, u32* reg_data); | ||
4469 | - | ||
4470 | -struct ll_temac { | ||
4471 | - phys_addr_t ctrladdr; | ||
4472 | - phys_addr_t sdma_reg_addr[SDMA_CTRL_REGNUMS]; | ||
4473 | - | ||
4474 | - unsigned (*in32)(phys_addr_t); | ||
4475 | - void (*out32)(phys_addr_t, unsigned); | ||
4476 | - | ||
4477 | - int (*ctrlinit) (struct eth_device *); | ||
4478 | - int (*ctrlhalt) (struct eth_device *); | ||
4479 | - int (*ctrlreset) (struct eth_device *); | ||
4480 | - | ||
4481 | - int phyaddr; | ||
4482 | - struct phy_device *phydev; | ||
4483 | - struct mii_dev *bus; | ||
4484 | - char mdio_busname[MDIO_NAME_LEN]; | ||
4485 | -}; | ||
4486 | - | ||
4487 | -#endif /* _XILINX_LL_TEMAC_ */ | ||
4488 | diff --git a/drivers/net/xilinx_ll_temac_fifo.c b/drivers/net/xilinx_ll_temac_fifo.c | ||
4489 | deleted file mode 100644 | ||
4490 | index d7fd989..0000000 | ||
4491 | --- a/drivers/net/xilinx_ll_temac_fifo.c | ||
4492 | +++ /dev/null | ||
4493 | @@ -1,142 +0,0 @@ | ||
4494 | -/* | ||
4495 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
4496 | - * | ||
4497 | - * FIFO sub-controller | ||
4498 | - * | ||
4499 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
4500 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
4501 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
4502 | - * | ||
4503 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
4504 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
4505 | - * March 2008 created | ||
4506 | - * | ||
4507 | - * CREDITS: tsec driver | ||
4508 | - * | ||
4509 | - * This program is free software; you can redistribute it and/or modify it | ||
4510 | - * under the terms of the GNU General Public License as published by the | ||
4511 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
4512 | - * option) any later version. | ||
4513 | - * | ||
4514 | - * [0]: http://www.xilinx.com/support/documentation | ||
4515 | - * | ||
4516 | - * [F]: [0]/ip_documentation/xps_ll_fifo.pdf | ||
4517 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4518 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
4519 | - */ | ||
4520 | - | ||
4521 | -#include <config.h> | ||
4522 | -#include <common.h> | ||
4523 | -#include <net.h> | ||
4524 | - | ||
4525 | -#include <asm/types.h> | ||
4526 | -#include <asm/io.h> | ||
4527 | - | ||
4528 | -#include "xilinx_ll_temac.h" | ||
4529 | -#include "xilinx_ll_temac_fifo.h" | ||
4530 | - | ||
4531 | -int ll_temac_reset_fifo(struct eth_device *dev) | ||
4532 | -{ | ||
4533 | - struct ll_temac *ll_temac = dev->priv; | ||
4534 | - struct fifo_ctrl *fifo_ctrl = (void *)ll_temac->ctrladdr; | ||
4535 | - | ||
4536 | - out_be32(&fifo_ctrl->tdfr, LL_FIFO_TDFR_KEY); | ||
4537 | - out_be32(&fifo_ctrl->rdfr, LL_FIFO_RDFR_KEY); | ||
4538 | - out_be32(&fifo_ctrl->isr, ~0UL); | ||
4539 | - out_be32(&fifo_ctrl->ier, 0); | ||
4540 | - | ||
4541 | - return 0; | ||
4542 | -} | ||
4543 | - | ||
4544 | -int ll_temac_recv_fifo(struct eth_device *dev) | ||
4545 | -{ | ||
4546 | - int i, length = 0; | ||
4547 | - u32 *buf = (u32 *)NetRxPackets[0]; | ||
4548 | - struct ll_temac *ll_temac = dev->priv; | ||
4549 | - struct fifo_ctrl *fifo_ctrl = (void *)ll_temac->ctrladdr; | ||
4550 | - | ||
4551 | - if (in_be32(&fifo_ctrl->isr) & LL_FIFO_ISR_RC) { | ||
4552 | - | ||
4553 | - /* reset isr */ | ||
4554 | - out_be32(&fifo_ctrl->isr, ~0UL); | ||
4555 | - | ||
4556 | - /* | ||
4557 | - * MAYBE here: | ||
4558 | - * while (fifo_ctrl->isr); | ||
4559 | - */ | ||
4560 | - | ||
4561 | - /* | ||
4562 | - * The length is written (into RLR) by the XPS LL FIFO | ||
4563 | - * when the packet is received across the RX LocalLink | ||
4564 | - * interface and the receive data FIFO had enough | ||
4565 | - * locations that all of the packet data has been saved. | ||
4566 | - * The RLR should only be read when a receive packet is | ||
4567 | - * available for processing (the receive occupancy is | ||
4568 | - * not zero). Once the RLR is read, the receive packet | ||
4569 | - * data should be read from the receive data FIFO before | ||
4570 | - * the RLR is read again. | ||
4571 | - * | ||
4572 | - * [F] page 17, Receive Length Register (RLR) | ||
4573 | - */ | ||
4574 | - if (in_be32(&fifo_ctrl->rdfo) & LL_FIFO_RDFO_MASK) { | ||
4575 | - length = in_be32(&fifo_ctrl->rlf) & LL_FIFO_RLF_MASK; | ||
4576 | - } else { | ||
4577 | - printf("%s: Got error, no receive occupancy\n", | ||
4578 | - __func__); | ||
4579 | - return -1; | ||
4580 | - } | ||
4581 | - | ||
4582 | - if (length > PKTSIZE_ALIGN) { | ||
4583 | - printf("%s: Got error, receive package too big (%i)\n", | ||
4584 | - __func__, length); | ||
4585 | - ll_temac_reset_fifo(dev); | ||
4586 | - return -1; | ||
4587 | - } | ||
4588 | - | ||
4589 | - for (i = 0; i < length; i += 4) | ||
4590 | - *buf++ = in_be32(&fifo_ctrl->rdfd); | ||
4591 | - | ||
4592 | - NetReceive(NetRxPackets[0], length); | ||
4593 | - } | ||
4594 | - | ||
4595 | - return 0; | ||
4596 | -} | ||
4597 | - | ||
4598 | -int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length) | ||
4599 | -{ | ||
4600 | - int i; | ||
4601 | - u32 *buf = (u32 *)packet; | ||
4602 | - struct ll_temac *ll_temac = dev->priv; | ||
4603 | - struct fifo_ctrl *fifo_ctrl = (void *)ll_temac->ctrladdr; | ||
4604 | - | ||
4605 | - if (length < LL_FIFO_TLF_MIN) { | ||
4606 | - printf("%s: Got error, transmit package too small (%i)\n", | ||
4607 | - __func__, length); | ||
4608 | - return -1; | ||
4609 | - } | ||
4610 | - | ||
4611 | - if (length > LL_FIFO_TLF_MAX) { | ||
4612 | - printf("%s: Got error, transmit package too big (%i)\n", | ||
4613 | - __func__, length); | ||
4614 | - return -1; | ||
4615 | - } | ||
4616 | - | ||
4617 | - for (i = 0; i < length; i += 4) | ||
4618 | - out_be32(&fifo_ctrl->tdfd, *buf++); | ||
4619 | - | ||
4620 | - /* | ||
4621 | - * Once the packet length is written to the TLR it is | ||
4622 | - * automatically moved to the transmit data FIFO with | ||
4623 | - * the packet data freeing up the TLR for another value. | ||
4624 | - * The packet length must be written to the TLR after | ||
4625 | - * the packet data is written to the transmit data FIFO. | ||
4626 | - * It is not valid to write data for multiple packets | ||
4627 | - * to the transmit data FIFO before writing the packet | ||
4628 | - * length values. | ||
4629 | - * | ||
4630 | - * [F] page 17, Transmit Length Register (TLR) | ||
4631 | - */ | ||
4632 | - out_be32(&fifo_ctrl->tlf, length); | ||
4633 | - | ||
4634 | - return 0; | ||
4635 | -} | ||
4636 | diff --git a/drivers/net/xilinx_ll_temac_fifo.h b/drivers/net/xilinx_ll_temac_fifo.h | ||
4637 | deleted file mode 100644 | ||
4638 | index e5b4be9..0000000 | ||
4639 | --- a/drivers/net/xilinx_ll_temac_fifo.h | ||
4640 | +++ /dev/null | ||
4641 | @@ -1,121 +0,0 @@ | ||
4642 | -/* | ||
4643 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
4644 | - * | ||
4645 | - * FIFO sub-controller interface | ||
4646 | - * | ||
4647 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
4648 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
4649 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
4650 | - * | ||
4651 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
4652 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
4653 | - * March 2008 created | ||
4654 | - * | ||
4655 | - * This program is free software; you can redistribute it and/or modify it | ||
4656 | - * under the terms of the GNU General Public License as published by the | ||
4657 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
4658 | - * option) any later version. | ||
4659 | - * | ||
4660 | - * [0]: http://www.xilinx.com/support/documentation | ||
4661 | - * | ||
4662 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4663 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
4664 | - */ | ||
4665 | -#ifndef _XILINX_LL_TEMAC_FIFO_ | ||
4666 | -#define _XILINX_LL_TEMAC_FIFO_ | ||
4667 | - | ||
4668 | -#include <net.h> | ||
4669 | - | ||
4670 | -#include <asm/types.h> | ||
4671 | -#include <asm/byteorder.h> | ||
4672 | - | ||
4673 | -#if !defined(__BIG_ENDIAN) | ||
4674 | -# error LL_TEMAC requires big endianess | ||
4675 | -#endif | ||
4676 | - | ||
4677 | -/* | ||
4678 | - * FIFO Register Definition | ||
4679 | - * | ||
4680 | - * Used for memory mapped access from and to (Rd/Td) the LocalLink (LL) | ||
4681 | - * Tri-Mode Ether MAC (TEMAC) via the 2 kb full duplex FIFO Controller, | ||
4682 | - * one for each. | ||
4683 | - * | ||
4684 | - * [1]: [0]/ip_documentation/xps_ll_fifo.pdf | ||
4685 | - * page 10, Registers Definition | ||
4686 | - */ | ||
4687 | -struct fifo_ctrl { | ||
4688 | - u32 isr; /* Interrupt Status Register (RW) */ | ||
4689 | - u32 ier; /* Interrupt Enable Register (RW) */ | ||
4690 | - u32 tdfr; /* Transmit Data FIFO Reset (WO) */ | ||
4691 | - u32 tdfv; /* Transmit Data FIFO Vacancy (RO) */ | ||
4692 | - u32 tdfd; /* Transmit Data FIFO 32bit wide Data write port (WO) */ | ||
4693 | - u32 tlf; /* Transmit Length FIFO (WO) */ | ||
4694 | - u32 rdfr; /* Receive Data FIFO Reset (WO) */ | ||
4695 | - u32 rdfo; /* Receive Data FIFO Occupancy (RO) */ | ||
4696 | - u32 rdfd; /* Receive Data FIFO 32bit wide Data read port (RO) */ | ||
4697 | - u32 rlf; /* Receive Length FIFO (RO) */ | ||
4698 | - u32 llr; /* LocalLink Reset (WO) */ | ||
4699 | -}; | ||
4700 | - | ||
4701 | -/* Interrupt Status Register (ISR), [1] p11 */ | ||
4702 | -#define LL_FIFO_ISR_RPURE (1 << 31) /* Receive Packet Underrun Read Err */ | ||
4703 | -#define LL_FIFO_ISR_RPORE (1 << 30) /* Receive Packet Overrun Read Err */ | ||
4704 | -#define LL_FIFO_ISR_RPUE (1 << 29) /* Receive Packet Underrun Error */ | ||
4705 | -#define LL_FIFO_ISR_TPOE (1 << 28) /* Transmit Packet Overrun Error */ | ||
4706 | -#define LL_FIFO_ISR_TC (1 << 27) /* Transmit Complete */ | ||
4707 | -#define LL_FIFO_ISR_RC (1 << 26) /* Receive Complete */ | ||
4708 | -#define LL_FIFO_ISR_TSE (1 << 25) /* Transmit Size Error */ | ||
4709 | -#define LL_FIFO_ISR_TRC (1 << 24) /* Transmit Reset Complete */ | ||
4710 | -#define LL_FIFO_ISR_RRC (1 << 23) /* Receive Reset Complete */ | ||
4711 | - | ||
4712 | -/* Interrupt Enable Register (IER), [1] p12/p13 */ | ||
4713 | -#define LL_FIFO_IER_RPURE (1 << 31) /* Receive Packet Underrun Read Err */ | ||
4714 | -#define LL_FIFO_IER_RPORE (1 << 30) /* Receive Packet Overrun Read Err */ | ||
4715 | -#define LL_FIFO_IER_RPUE (1 << 29) /* Receive Packet Underrun Error */ | ||
4716 | -#define LL_FIFO_IER_TPOE (1 << 28) /* Transmit Packet Overrun Error */ | ||
4717 | -#define LL_FIFO_IER_TC (1 << 27) /* Transmit Complete */ | ||
4718 | -#define LL_FIFO_IER_RC (1 << 26) /* Receive Complete */ | ||
4719 | -#define LL_FIFO_IER_TSE (1 << 25) /* Transmit Size Error */ | ||
4720 | -#define LL_FIFO_IER_TRC (1 << 24) /* Transmit Reset Complete */ | ||
4721 | -#define LL_FIFO_IER_RRC (1 << 23) /* Receive Reset Complete */ | ||
4722 | - | ||
4723 | -/* Transmit Data FIFO Reset (TDFR), [1] p13/p14 */ | ||
4724 | -#define LL_FIFO_TDFR_KEY 0x000000A5UL | ||
4725 | - | ||
4726 | -/* Transmit Data FIFO Vacancy (TDFV), [1] p14 */ | ||
4727 | -#define LL_FIFO_TDFV_POS 0 | ||
4728 | -#define LL_FIFO_TDFV_MASK (0x000001FFUL << LL_FIFO_TDFV_POS) | ||
4729 | - | ||
4730 | -/* Transmit Length FIFO (TLF), [1] p16/p17 */ | ||
4731 | -#define LL_FIFO_TLF_POS 0 | ||
4732 | -#define LL_FIFO_TLF_MASK (0x000007FFUL << LL_FIFO_TLF_POS) | ||
4733 | -#define LL_FIFO_TLF_MIN ((4 * sizeof(u32)) & LL_FIFO_TLF_MASK) | ||
4734 | -#define LL_FIFO_TLF_MAX ((510 * sizeof(u32)) & LL_FIFO_TLF_MASK) | ||
4735 | - | ||
4736 | -/* Receive Data FIFO Reset (RDFR), [1] p15 */ | ||
4737 | -#define LL_FIFO_RDFR_KEY 0x000000A5UL | ||
4738 | - | ||
4739 | -/* Receive Data FIFO Occupancy (RDFO), [1] p16 */ | ||
4740 | -#define LL_FIFO_RDFO_POS 0 | ||
4741 | -#define LL_FIFO_RDFO_MASK (0x000001FFUL << LL_FIFO_RDFO_POS) | ||
4742 | - | ||
4743 | -/* Receive Length FIFO (RLF), [1] p17/p18 */ | ||
4744 | -#define LL_FIFO_RLF_POS 0 | ||
4745 | -#define LL_FIFO_RLF_MASK (0x000007FFUL << LL_FIFO_RLF_POS) | ||
4746 | -#define LL_FIFO_RLF_MIN ((4 * sizeof(uint32)) & LL_FIFO_RLF_MASK) | ||
4747 | -#define LL_FIFO_RLF_MAX ((510 * sizeof(uint32)) & LL_FIFO_RLF_MASK) | ||
4748 | - | ||
4749 | -/* LocalLink Reset (LLR), [1] p18 */ | ||
4750 | -#define LL_FIFO_LLR_KEY 0x000000A5UL | ||
4751 | - | ||
4752 | - | ||
4753 | -/* reset FIFO and IRQ, disable interrupts */ | ||
4754 | -int ll_temac_reset_fifo(struct eth_device *dev); | ||
4755 | - | ||
4756 | -/* receive buffered data from FIFO (polling ISR) */ | ||
4757 | -int ll_temac_recv_fifo(struct eth_device *dev); | ||
4758 | - | ||
4759 | -/* send buffered data to FIFO */ | ||
4760 | -int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length); | ||
4761 | - | ||
4762 | -#endif /* _XILINX_LL_TEMAC_FIFO_ */ | ||
4763 | diff --git a/drivers/net/xilinx_ll_temac_mdio.c b/drivers/net/xilinx_ll_temac_mdio.c | ||
4764 | deleted file mode 100644 | ||
4765 | index c56ff48..0000000 | ||
4766 | --- a/drivers/net/xilinx_ll_temac_mdio.c | ||
4767 | +++ /dev/null | ||
4768 | @@ -1,180 +0,0 @@ | ||
4769 | -/* | ||
4770 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
4771 | - * | ||
4772 | - * MDIO bus access | ||
4773 | - * | ||
4774 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
4775 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
4776 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
4777 | - * | ||
4778 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
4779 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
4780 | - * March 2008 created | ||
4781 | - * | ||
4782 | - * CREDITS: tsec driver | ||
4783 | - * | ||
4784 | - * This program is free software; you can redistribute it and/or modify it | ||
4785 | - * under the terms of the GNU General Public License as published by the | ||
4786 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
4787 | - * option) any later version. | ||
4788 | - * | ||
4789 | - * [0]: http://www.xilinx.com/support/documentation | ||
4790 | - * | ||
4791 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4792 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
4793 | - */ | ||
4794 | - | ||
4795 | -#include <config.h> | ||
4796 | -#include <common.h> | ||
4797 | -#include <miiphy.h> | ||
4798 | -#include <phy.h> | ||
4799 | -#include <malloc.h> | ||
4800 | -#include <asm/io.h> | ||
4801 | - | ||
4802 | -#include "xilinx_ll_temac.h" | ||
4803 | -#include "xilinx_ll_temac_mdio.h" | ||
4804 | - | ||
4805 | -#if !defined(CONFIG_MII) | ||
4806 | -# error "LL_TEMAC requires MII -- missing CONFIG_MII" | ||
4807 | -#endif | ||
4808 | - | ||
4809 | -#if !defined(CONFIG_PHYLIB) | ||
4810 | -# error "LL_TEMAC requires PHYLIB -- missing CONFIG_PHYLIB" | ||
4811 | -#endif | ||
4812 | - | ||
4813 | -/* | ||
4814 | - * Prior to PHY access, the MDIO clock must be setup. This driver will set a | ||
4815 | - * safe default that should work with PLB bus speeds of up to 150 MHz and keep | ||
4816 | - * the MDIO clock below 2.5 MHz. If the user wishes faster access to the PHY | ||
4817 | - * then the clock divisor can be set to a different value by setting the | ||
4818 | - * correct bus speed value with CONFIG_XILINX_LL_TEMAC_CLK. | ||
4819 | - */ | ||
4820 | -#if !defined(CONFIG_XILINX_LL_TEMAC_CLK) | ||
4821 | -#define MDIO_CLOCK_DIV MC_CLKDIV_10(150000000) | ||
4822 | -#else | ||
4823 | -#define MDIO_CLOCK_DIV MC_CLKDIV_25(CONFIG_XILINX_LL_TEMAC_CLK) | ||
4824 | -#endif | ||
4825 | - | ||
4826 | -static int ll_temac_mdio_setup(struct mii_dev *bus) | ||
4827 | -{ | ||
4828 | - struct temac_reg *regs = (struct temac_reg *)bus->priv; | ||
4829 | - | ||
4830 | - /* setup MDIO clock */ | ||
4831 | - ll_temac_indirect_set(regs, TEMAC_MC, | ||
4832 | - MC_MDIOEN | (MDIO_CLOCK_DIV & MC_CLKDIV_MASK)); | ||
4833 | - | ||
4834 | - return 0; | ||
4835 | -} | ||
4836 | - | ||
4837 | -/* | ||
4838 | - * Indirect MII PHY read via ll_temac. | ||
4839 | - * | ||
4840 | - * http://www.xilinx.com/support/documentation/ip_documentation/xps_ll_temac.pdf | ||
4841 | - * page 67, Using the MII Management to Access PHY Registers | ||
4842 | - */ | ||
4843 | -int ll_temac_local_mdio_read(struct temac_reg *regs, int addr, int devad, | ||
4844 | - int regnum) | ||
4845 | -{ | ||
4846 | - out_be32(®s->lsw, | ||
4847 | - ((addr << LSW_PHYAD_POS) & LSW_PHYAD_MASK) | | ||
4848 | - (regnum & LSW_REGAD_MASK)); | ||
4849 | - out_be32(®s->ctl, TEMAC_MIIMAI); | ||
4850 | - | ||
4851 | - ll_temac_check_status(regs, RSE_MIIM_RR); | ||
4852 | - | ||
4853 | - return in_be32(®s->lsw) & LSW_REGDAT_MASK; | ||
4854 | -} | ||
4855 | - | ||
4856 | -/* | ||
4857 | - * Indirect MII PHY write via ll_temac. | ||
4858 | - * | ||
4859 | - * http://www.xilinx.com/support/documentation/ip_documentation/xps_ll_temac.pdf | ||
4860 | - * page 67, Using the MII Management to Access PHY Registers | ||
4861 | - */ | ||
4862 | -void ll_temac_local_mdio_write(struct temac_reg *regs, int addr, int devad, | ||
4863 | - int regnum, u16 value) | ||
4864 | -{ | ||
4865 | - out_be32(®s->lsw, (value & LSW_REGDAT_MASK)); | ||
4866 | - out_be32(®s->ctl, CTL_WEN | TEMAC_MIIMWD); | ||
4867 | - | ||
4868 | - out_be32(®s->lsw, | ||
4869 | - ((addr << LSW_PHYAD_POS) & LSW_PHYAD_MASK) | | ||
4870 | - (regnum & LSW_REGAD_MASK)); | ||
4871 | - out_be32(®s->ctl, CTL_WEN | TEMAC_MIIMAI); | ||
4872 | - | ||
4873 | - ll_temac_check_status(regs, RSE_MIIM_WR); | ||
4874 | -} | ||
4875 | - | ||
4876 | -int ll_temac_phy_read(struct mii_dev *bus, int addr, int devad, int regnum) | ||
4877 | -{ | ||
4878 | - struct temac_reg *regs = (struct temac_reg *)bus->priv; | ||
4879 | - | ||
4880 | - return ll_temac_local_mdio_read(regs, addr, devad, regnum); | ||
4881 | -} | ||
4882 | - | ||
4883 | -int ll_temac_phy_write(struct mii_dev *bus, int addr, int devad, int regnum, | ||
4884 | - u16 value) | ||
4885 | -{ | ||
4886 | - struct temac_reg *regs = (struct temac_reg *)bus->priv; | ||
4887 | - | ||
4888 | - ll_temac_local_mdio_write(regs, addr, devad, regnum, value); | ||
4889 | - | ||
4890 | - return 0; | ||
4891 | -} | ||
4892 | - | ||
4893 | -/* | ||
4894 | - * Use MII register 1 (MII status register) to detect PHY | ||
4895 | - * | ||
4896 | - * A Mask used to verify certain PHY features (register content) | ||
4897 | - * in the PHY detection register: | ||
4898 | - * Auto-negotiation support, 10Mbps half/full duplex support | ||
4899 | - */ | ||
4900 | -#define PHY_DETECT_REG MII_BMSR | ||
4901 | -#define PHY_DETECT_MASK (BMSR_10FULL | BMSR_10HALF | BMSR_ANEGCAPABLE) | ||
4902 | - | ||
4903 | -/* Looking for a valid PHY address */ | ||
4904 | -int ll_temac_phy_addr(struct mii_dev *bus) | ||
4905 | -{ | ||
4906 | - struct temac_reg *regs = (struct temac_reg *)bus->priv; | ||
4907 | - unsigned short val; | ||
4908 | - unsigned int phy; | ||
4909 | - | ||
4910 | - for (phy = PHY_MAX_ADDR; phy >= 0; phy--) { | ||
4911 | - val = ll_temac_local_mdio_read(regs, phy, 0, PHY_DETECT_REG); | ||
4912 | - if ((val != 0xFFFF) && | ||
4913 | - ((val & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
4914 | - /* Found a valid PHY address */ | ||
4915 | - return phy; | ||
4916 | - } | ||
4917 | - } | ||
4918 | - | ||
4919 | - return -1; | ||
4920 | -} | ||
4921 | - | ||
4922 | -int xilinx_ll_temac_mdio_initialize(bd_t *bis, struct ll_temac_mdio_info *info) | ||
4923 | -{ | ||
4924 | - struct mii_dev *bus = mdio_alloc(); | ||
4925 | - | ||
4926 | - if (!bus) { | ||
4927 | - printf("Failed to allocate LL_TEMAC MDIO bus: %s\n", | ||
4928 | - info->name); | ||
4929 | - return -1; | ||
4930 | - } | ||
4931 | - | ||
4932 | - bus->read = ll_temac_phy_read; | ||
4933 | - bus->write = ll_temac_phy_write; | ||
4934 | - bus->reset = NULL; | ||
4935 | - | ||
4936 | - /* use given name or generate its own unique name */ | ||
4937 | - if (info->name) { | ||
4938 | - strncpy(bus->name, info->name, MDIO_NAME_LEN); | ||
4939 | - } else { | ||
4940 | - snprintf(bus->name, MDIO_NAME_LEN, "lltemii.%p", info->regs); | ||
4941 | - info->name = bus->name; | ||
4942 | - } | ||
4943 | - | ||
4944 | - bus->priv = info->regs; | ||
4945 | - | ||
4946 | - ll_temac_mdio_setup(bus); | ||
4947 | - return mdio_register(bus); | ||
4948 | -} | ||
4949 | diff --git a/drivers/net/xilinx_ll_temac_mdio.h b/drivers/net/xilinx_ll_temac_mdio.h | ||
4950 | deleted file mode 100644 | ||
4951 | index 8d8fabd..0000000 | ||
4952 | --- a/drivers/net/xilinx_ll_temac_mdio.h | ||
4953 | +++ /dev/null | ||
4954 | @@ -1,53 +0,0 @@ | ||
4955 | -/* | ||
4956 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
4957 | - * | ||
4958 | - * MDIO bus access interface | ||
4959 | - * | ||
4960 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
4961 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
4962 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
4963 | - * | ||
4964 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
4965 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
4966 | - * March 2008 created | ||
4967 | - * | ||
4968 | - * This program is free software; you can redistribute it and/or modify it | ||
4969 | - * under the terms of the GNU General Public License as published by the | ||
4970 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
4971 | - * option) any later version. | ||
4972 | - * | ||
4973 | - * [0]: http://www.xilinx.com/support/documentation | ||
4974 | - * | ||
4975 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
4976 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
4977 | - */ | ||
4978 | -#ifndef _XILINX_LL_TEMAC_MDIO_ | ||
4979 | -#define _XILINX_LL_TEMAC_MDIO_ | ||
4980 | - | ||
4981 | -#include <net.h> | ||
4982 | -#include <miiphy.h> | ||
4983 | - | ||
4984 | -#include <asm/types.h> | ||
4985 | -#include <asm/byteorder.h> | ||
4986 | - | ||
4987 | -#include "xilinx_ll_temac.h" | ||
4988 | - | ||
4989 | -int ll_temac_local_mdio_read(struct temac_reg *regs, int addr, int devad, | ||
4990 | - int regnum); | ||
4991 | -void ll_temac_local_mdio_write(struct temac_reg *regs, int addr, int devad, | ||
4992 | - int regnum, u16 value); | ||
4993 | - | ||
4994 | -int ll_temac_phy_read(struct mii_dev *bus, int addr, int devad, int regnum); | ||
4995 | -int ll_temac_phy_write(struct mii_dev *bus, int addr, int devad, int regnum, | ||
4996 | - u16 value); | ||
4997 | - | ||
4998 | -int ll_temac_phy_addr(struct mii_dev *bus); | ||
4999 | - | ||
5000 | -struct ll_temac_mdio_info { | ||
5001 | - struct temac_reg *regs; | ||
5002 | - char *name; | ||
5003 | -}; | ||
5004 | - | ||
5005 | -int xilinx_ll_temac_mdio_initialize(bd_t *bis, struct ll_temac_mdio_info *info); | ||
5006 | - | ||
5007 | -#endif /* _XILINX_LL_TEMAC_MDIO_ */ | ||
5008 | diff --git a/drivers/net/xilinx_ll_temac_sdma.c b/drivers/net/xilinx_ll_temac_sdma.c | ||
5009 | deleted file mode 100644 | ||
5010 | index 8637a6b..0000000 | ||
5011 | --- a/drivers/net/xilinx_ll_temac_sdma.c | ||
5012 | +++ /dev/null | ||
5013 | @@ -1,369 +0,0 @@ | ||
5014 | -/* | ||
5015 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
5016 | - * | ||
5017 | - * SDMA sub-controller | ||
5018 | - * | ||
5019 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
5020 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
5021 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
5022 | - * | ||
5023 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
5024 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
5025 | - * March 2008 created | ||
5026 | - * | ||
5027 | - * CREDITS: tsec driver | ||
5028 | - * | ||
5029 | - * This program is free software; you can redistribute it and/or modify it | ||
5030 | - * under the terms of the GNU General Public License as published by the | ||
5031 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
5032 | - * option) any later version. | ||
5033 | - * | ||
5034 | - * [0]: http://www.xilinx.com/support/documentation | ||
5035 | - * | ||
5036 | - * [M]: [0]/ip_documentation/mpmc.pdf | ||
5037 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
5038 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
5039 | - */ | ||
5040 | - | ||
5041 | -#include <config.h> | ||
5042 | -#include <common.h> | ||
5043 | -#include <net.h> | ||
5044 | - | ||
5045 | -#include <asm/types.h> | ||
5046 | -#include <asm/io.h> | ||
5047 | - | ||
5048 | -#include "xilinx_ll_temac.h" | ||
5049 | -#include "xilinx_ll_temac_sdma.h" | ||
5050 | - | ||
5051 | -#define TX_BUF_CNT 2 | ||
5052 | - | ||
5053 | -static unsigned int rx_idx; /* index of the current RX buffer */ | ||
5054 | -static unsigned int tx_idx; /* index of the current TX buffer */ | ||
5055 | - | ||
5056 | -struct rtx_cdmac_bd { | ||
5057 | - struct cdmac_bd rx[PKTBUFSRX]; | ||
5058 | - struct cdmac_bd tx[TX_BUF_CNT]; | ||
5059 | -}; | ||
5060 | - | ||
5061 | -/* | ||
5062 | - * DMA Buffer Descriptor alignment | ||
5063 | - * | ||
5064 | - * If the address contained in the Next Descriptor Pointer register is not | ||
5065 | - * 8-word aligned or reaches beyond the range of available memory, the SDMA | ||
5066 | - * halts processing and sets the CDMAC_BD_STCTRL_ERROR bit in the respective | ||
5067 | - * status register (tx_chnl_sts or rx_chnl_sts). | ||
5068 | - * | ||
5069 | - * [1]: [0]/ip_documentation/mpmc.pdf | ||
5070 | - * page 161, Next Descriptor Pointer | ||
5071 | - */ | ||
5072 | -static struct rtx_cdmac_bd cdmac_bd __aligned(32); | ||
5073 | - | ||
5074 | -#if defined(CONFIG_XILINX_440) || defined(CONFIG_XILINX_405) | ||
5075 | - | ||
5076 | -/* | ||
5077 | - * Indirect DCR access operations mi{ft}dcr_xilinx() espacialy | ||
5078 | - * for Xilinx PowerPC implementations on FPGA. | ||
5079 | - * | ||
5080 | - * FIXME: This part should go up to arch/powerpc -- but where? | ||
5081 | - */ | ||
5082 | -#include <asm/processor.h> | ||
5083 | -#define XILINX_INDIRECT_DCR_ADDRESS_REG 0 | ||
5084 | -#define XILINX_INDIRECT_DCR_ACCESS_REG 1 | ||
5085 | -inline unsigned mifdcr_xilinx(const unsigned dcrn) | ||
5086 | -{ | ||
5087 | - mtdcr(XILINX_INDIRECT_DCR_ADDRESS_REG, dcrn); | ||
5088 | - return mfdcr(XILINX_INDIRECT_DCR_ACCESS_REG); | ||
5089 | -} | ||
5090 | -inline void mitdcr_xilinx(const unsigned dcrn, int val) | ||
5091 | -{ | ||
5092 | - mtdcr(XILINX_INDIRECT_DCR_ADDRESS_REG, dcrn); | ||
5093 | - mtdcr(XILINX_INDIRECT_DCR_ACCESS_REG, val); | ||
5094 | -} | ||
5095 | - | ||
5096 | -/* Xilinx Device Control Register (DCR) in/out accessors */ | ||
5097 | -inline unsigned ll_temac_xldcr_in32(phys_addr_t addr) | ||
5098 | -{ | ||
5099 | - return mifdcr_xilinx((const unsigned)addr); | ||
5100 | -} | ||
5101 | -inline void ll_temac_xldcr_out32(phys_addr_t addr, unsigned value) | ||
5102 | -{ | ||
5103 | - mitdcr_xilinx((const unsigned)addr, value); | ||
5104 | -} | ||
5105 | - | ||
5106 | -void ll_temac_collect_xldcr_sdma_reg_addr(struct eth_device *dev) | ||
5107 | -{ | ||
5108 | - struct ll_temac *ll_temac = dev->priv; | ||
5109 | - phys_addr_t dmac_ctrl = ll_temac->ctrladdr; | ||
5110 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5111 | - | ||
5112 | - ra[TX_NXTDESC_PTR] = dmac_ctrl + TX_NXTDESC_PTR; | ||
5113 | - ra[TX_CURBUF_ADDR] = dmac_ctrl + TX_CURBUF_ADDR; | ||
5114 | - ra[TX_CURBUF_LENGTH] = dmac_ctrl + TX_CURBUF_LENGTH; | ||
5115 | - ra[TX_CURDESC_PTR] = dmac_ctrl + TX_CURDESC_PTR; | ||
5116 | - ra[TX_TAILDESC_PTR] = dmac_ctrl + TX_TAILDESC_PTR; | ||
5117 | - ra[TX_CHNL_CTRL] = dmac_ctrl + TX_CHNL_CTRL; | ||
5118 | - ra[TX_IRQ_REG] = dmac_ctrl + TX_IRQ_REG; | ||
5119 | - ra[TX_CHNL_STS] = dmac_ctrl + TX_CHNL_STS; | ||
5120 | - ra[RX_NXTDESC_PTR] = dmac_ctrl + RX_NXTDESC_PTR; | ||
5121 | - ra[RX_CURBUF_ADDR] = dmac_ctrl + RX_CURBUF_ADDR; | ||
5122 | - ra[RX_CURBUF_LENGTH] = dmac_ctrl + RX_CURBUF_LENGTH; | ||
5123 | - ra[RX_CURDESC_PTR] = dmac_ctrl + RX_CURDESC_PTR; | ||
5124 | - ra[RX_TAILDESC_PTR] = dmac_ctrl + RX_TAILDESC_PTR; | ||
5125 | - ra[RX_CHNL_CTRL] = dmac_ctrl + RX_CHNL_CTRL; | ||
5126 | - ra[RX_IRQ_REG] = dmac_ctrl + RX_IRQ_REG; | ||
5127 | - ra[RX_CHNL_STS] = dmac_ctrl + RX_CHNL_STS; | ||
5128 | - ra[DMA_CONTROL_REG] = dmac_ctrl + DMA_CONTROL_REG; | ||
5129 | -} | ||
5130 | - | ||
5131 | -#endif /* CONFIG_XILINX_440 || ONFIG_XILINX_405 */ | ||
5132 | - | ||
5133 | -/* Xilinx Processor Local Bus (PLB) in/out accessors */ | ||
5134 | -inline unsigned ll_temac_xlplb_in32(phys_addr_t addr) | ||
5135 | -{ | ||
5136 | - return in_be32((void *)addr); | ||
5137 | -} | ||
5138 | -inline void ll_temac_xlplb_out32(phys_addr_t addr, unsigned value) | ||
5139 | -{ | ||
5140 | - out_be32((void *)addr, value); | ||
5141 | -} | ||
5142 | - | ||
5143 | -/* collect all register addresses for Xilinx PLB in/out accessors */ | ||
5144 | -void ll_temac_collect_xlplb_sdma_reg_addr(struct eth_device *dev) | ||
5145 | -{ | ||
5146 | - struct ll_temac *ll_temac = dev->priv; | ||
5147 | - struct sdma_ctrl *sdma_ctrl = (void *)ll_temac->ctrladdr; | ||
5148 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5149 | - | ||
5150 | - ra[TX_NXTDESC_PTR] = (phys_addr_t)&sdma_ctrl->tx_nxtdesc_ptr; | ||
5151 | - ra[TX_CURBUF_ADDR] = (phys_addr_t)&sdma_ctrl->tx_curbuf_addr; | ||
5152 | - ra[TX_CURBUF_LENGTH] = (phys_addr_t)&sdma_ctrl->tx_curbuf_length; | ||
5153 | - ra[TX_CURDESC_PTR] = (phys_addr_t)&sdma_ctrl->tx_curdesc_ptr; | ||
5154 | - ra[TX_TAILDESC_PTR] = (phys_addr_t)&sdma_ctrl->tx_taildesc_ptr; | ||
5155 | - ra[TX_CHNL_CTRL] = (phys_addr_t)&sdma_ctrl->tx_chnl_ctrl; | ||
5156 | - ra[TX_IRQ_REG] = (phys_addr_t)&sdma_ctrl->tx_irq_reg; | ||
5157 | - ra[TX_CHNL_STS] = (phys_addr_t)&sdma_ctrl->tx_chnl_sts; | ||
5158 | - ra[RX_NXTDESC_PTR] = (phys_addr_t)&sdma_ctrl->rx_nxtdesc_ptr; | ||
5159 | - ra[RX_CURBUF_ADDR] = (phys_addr_t)&sdma_ctrl->rx_curbuf_addr; | ||
5160 | - ra[RX_CURBUF_LENGTH] = (phys_addr_t)&sdma_ctrl->rx_curbuf_length; | ||
5161 | - ra[RX_CURDESC_PTR] = (phys_addr_t)&sdma_ctrl->rx_curdesc_ptr; | ||
5162 | - ra[RX_TAILDESC_PTR] = (phys_addr_t)&sdma_ctrl->rx_taildesc_ptr; | ||
5163 | - ra[RX_CHNL_CTRL] = (phys_addr_t)&sdma_ctrl->rx_chnl_ctrl; | ||
5164 | - ra[RX_IRQ_REG] = (phys_addr_t)&sdma_ctrl->rx_irq_reg; | ||
5165 | - ra[RX_CHNL_STS] = (phys_addr_t)&sdma_ctrl->rx_chnl_sts; | ||
5166 | - ra[DMA_CONTROL_REG] = (phys_addr_t)&sdma_ctrl->dma_control_reg; | ||
5167 | -} | ||
5168 | - | ||
5169 | -/* Check for TX and RX channel errors. */ | ||
5170 | -static inline int ll_temac_sdma_error(struct eth_device *dev) | ||
5171 | -{ | ||
5172 | - int err; | ||
5173 | - struct ll_temac *ll_temac = dev->priv; | ||
5174 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5175 | - | ||
5176 | - err = ll_temac->in32(ra[TX_CHNL_STS]) & CHNL_STS_ERROR; | ||
5177 | - err |= ll_temac->in32(ra[RX_CHNL_STS]) & CHNL_STS_ERROR; | ||
5178 | - | ||
5179 | - return err; | ||
5180 | -} | ||
5181 | - | ||
5182 | -int ll_temac_init_sdma(struct eth_device *dev) | ||
5183 | -{ | ||
5184 | - struct ll_temac *ll_temac = dev->priv; | ||
5185 | - struct cdmac_bd *rx_dp; | ||
5186 | - struct cdmac_bd *tx_dp; | ||
5187 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5188 | - int i; | ||
5189 | - | ||
5190 | - printf("%s: SDMA: %d Rx buffers, %d Tx buffers\n", | ||
5191 | - dev->name, PKTBUFSRX, TX_BUF_CNT); | ||
5192 | - | ||
5193 | - /* Initialize the Rx Buffer descriptors */ | ||
5194 | - for (i = 0; i < PKTBUFSRX; i++) { | ||
5195 | - rx_dp = &cdmac_bd.rx[i]; | ||
5196 | - memset(rx_dp, 0, sizeof(*rx_dp)); | ||
5197 | - rx_dp->next_p = rx_dp; | ||
5198 | - rx_dp->buf_len = PKTSIZE_ALIGN; | ||
5199 | - rx_dp->phys_buf_p = (u8 *)NetRxPackets[i]; | ||
5200 | - flush_cache((u32)rx_dp->phys_buf_p, PKTSIZE_ALIGN); | ||
5201 | - } | ||
5202 | - flush_cache((u32)cdmac_bd.rx, sizeof(cdmac_bd.rx)); | ||
5203 | - | ||
5204 | - /* Initialize the TX Buffer Descriptors */ | ||
5205 | - for (i = 0; i < TX_BUF_CNT; i++) { | ||
5206 | - tx_dp = &cdmac_bd.tx[i]; | ||
5207 | - memset(tx_dp, 0, sizeof(*tx_dp)); | ||
5208 | - tx_dp->next_p = tx_dp; | ||
5209 | - } | ||
5210 | - flush_cache((u32)cdmac_bd.tx, sizeof(cdmac_bd.tx)); | ||
5211 | - | ||
5212 | - /* Reset index counter to the Rx and Tx Buffer descriptors */ | ||
5213 | - rx_idx = tx_idx = 0; | ||
5214 | - | ||
5215 | - /* initial Rx DMA start by writing to respective TAILDESC_PTR */ | ||
5216 | - ll_temac->out32(ra[RX_CURDESC_PTR], (int)&cdmac_bd.rx[rx_idx]); | ||
5217 | - ll_temac->out32(ra[RX_TAILDESC_PTR], (int)&cdmac_bd.rx[rx_idx]); | ||
5218 | - | ||
5219 | - return 0; | ||
5220 | -} | ||
5221 | - | ||
5222 | -int ll_temac_halt_sdma(struct eth_device *dev) | ||
5223 | -{ | ||
5224 | - unsigned timeout = 50; /* 1usec * 50 = 50usec */ | ||
5225 | - struct ll_temac *ll_temac = dev->priv; | ||
5226 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5227 | - | ||
5228 | - /* | ||
5229 | - * Soft reset the DMA | ||
5230 | - * | ||
5231 | - * Quote from MPMC documentation: Writing a 1 to this field | ||
5232 | - * forces the DMA engine to shutdown and reset itself. After | ||
5233 | - * setting this bit, software must poll it until the bit is | ||
5234 | - * cleared by the DMA. This indicates that the reset process | ||
5235 | - * is done and the pipeline has been flushed. | ||
5236 | - */ | ||
5237 | - ll_temac->out32(ra[DMA_CONTROL_REG], DMA_CONTROL_RESET); | ||
5238 | - while (timeout && (ll_temac->in32(ra[DMA_CONTROL_REG]) | ||
5239 | - & DMA_CONTROL_RESET)) { | ||
5240 | - timeout--; | ||
5241 | - udelay(1); | ||
5242 | - } | ||
5243 | - | ||
5244 | - if (!timeout) { | ||
5245 | - printf("%s: Timeout\n", __func__); | ||
5246 | - return -1; | ||
5247 | - } | ||
5248 | - | ||
5249 | - return 0; | ||
5250 | -} | ||
5251 | - | ||
5252 | -int ll_temac_reset_sdma(struct eth_device *dev) | ||
5253 | -{ | ||
5254 | - u32 r; | ||
5255 | - struct ll_temac *ll_temac = dev->priv; | ||
5256 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5257 | - | ||
5258 | - /* Soft reset the DMA. */ | ||
5259 | - if (ll_temac_halt_sdma(dev)) | ||
5260 | - return -1; | ||
5261 | - | ||
5262 | - /* Now clear the interrupts. */ | ||
5263 | - r = ll_temac->in32(ra[TX_CHNL_CTRL]); | ||
5264 | - r &= ~CHNL_CTRL_IRQ_MASK; | ||
5265 | - ll_temac->out32(ra[TX_CHNL_CTRL], r); | ||
5266 | - | ||
5267 | - r = ll_temac->in32(ra[RX_CHNL_CTRL]); | ||
5268 | - r &= ~CHNL_CTRL_IRQ_MASK; | ||
5269 | - ll_temac->out32(ra[RX_CHNL_CTRL], r); | ||
5270 | - | ||
5271 | - /* Now ACK pending IRQs. */ | ||
5272 | - ll_temac->out32(ra[TX_IRQ_REG], IRQ_REG_IRQ_MASK); | ||
5273 | - ll_temac->out32(ra[RX_IRQ_REG], IRQ_REG_IRQ_MASK); | ||
5274 | - | ||
5275 | - /* Set tail-ptr mode, disable errors for both channels. */ | ||
5276 | - ll_temac->out32(ra[DMA_CONTROL_REG], | ||
5277 | - /* Enable use of tail pointer register */ | ||
5278 | - DMA_CONTROL_TPE | | ||
5279 | - /* Disable error when 2 or 4 bit coalesce cnt overfl */ | ||
5280 | - DMA_CONTROL_RXOCEID | | ||
5281 | - /* Disable error when 2 or 4 bit coalesce cnt overfl */ | ||
5282 | - DMA_CONTROL_TXOCEID); | ||
5283 | - | ||
5284 | - return 0; | ||
5285 | -} | ||
5286 | - | ||
5287 | -int ll_temac_recv_sdma(struct eth_device *dev) | ||
5288 | -{ | ||
5289 | - int length, pb_idx; | ||
5290 | - struct cdmac_bd *rx_dp = &cdmac_bd.rx[rx_idx]; | ||
5291 | - struct ll_temac *ll_temac = dev->priv; | ||
5292 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5293 | - | ||
5294 | - if (ll_temac_sdma_error(dev)) { | ||
5295 | - | ||
5296 | - if (ll_temac_reset_sdma(dev)) | ||
5297 | - return -1; | ||
5298 | - | ||
5299 | - ll_temac_init_sdma(dev); | ||
5300 | - } | ||
5301 | - | ||
5302 | - flush_cache((u32)rx_dp, sizeof(*rx_dp)); | ||
5303 | - | ||
5304 | - if (!(rx_dp->sca.stctrl & CDMAC_BD_STCTRL_COMPLETED)) | ||
5305 | - return 0; | ||
5306 | - | ||
5307 | - if (rx_dp->sca.stctrl & (CDMAC_BD_STCTRL_SOP | CDMAC_BD_STCTRL_EOP)) { | ||
5308 | - pb_idx = rx_idx; | ||
5309 | - length = rx_dp->sca.app[4] & CDMAC_BD_APP4_RXBYTECNT_MASK; | ||
5310 | - } else { | ||
5311 | - pb_idx = -1; | ||
5312 | - length = 0; | ||
5313 | - printf("%s: Got part of package, unsupported (%x)\n", | ||
5314 | - __func__, rx_dp->sca.stctrl); | ||
5315 | - } | ||
5316 | - | ||
5317 | - /* flip the buffer */ | ||
5318 | - flush_cache((u32)rx_dp->phys_buf_p, length); | ||
5319 | - | ||
5320 | - /* reset the current descriptor */ | ||
5321 | - rx_dp->sca.stctrl = 0; | ||
5322 | - rx_dp->sca.app[4] = 0; | ||
5323 | - flush_cache((u32)rx_dp, sizeof(*rx_dp)); | ||
5324 | - | ||
5325 | - /* Find next empty buffer descriptor, preparation for next iteration */ | ||
5326 | - rx_idx = (rx_idx + 1) % PKTBUFSRX; | ||
5327 | - rx_dp = &cdmac_bd.rx[rx_idx]; | ||
5328 | - flush_cache((u32)rx_dp, sizeof(*rx_dp)); | ||
5329 | - | ||
5330 | - /* DMA start by writing to respective TAILDESC_PTR */ | ||
5331 | - ll_temac->out32(ra[RX_CURDESC_PTR], (int)&cdmac_bd.rx[rx_idx]); | ||
5332 | - ll_temac->out32(ra[RX_TAILDESC_PTR], (int)&cdmac_bd.rx[rx_idx]); | ||
5333 | - | ||
5334 | - if (length > 0 && pb_idx != -1) | ||
5335 | - NetReceive(NetRxPackets[pb_idx], length); | ||
5336 | - | ||
5337 | - return 0; | ||
5338 | -} | ||
5339 | - | ||
5340 | -int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length) | ||
5341 | -{ | ||
5342 | - unsigned timeout = 50; /* 1usec * 50 = 50usec */ | ||
5343 | - struct cdmac_bd *tx_dp = &cdmac_bd.tx[tx_idx]; | ||
5344 | - struct ll_temac *ll_temac = dev->priv; | ||
5345 | - phys_addr_t *ra = ll_temac->sdma_reg_addr; | ||
5346 | - | ||
5347 | - if (ll_temac_sdma_error(dev)) { | ||
5348 | - | ||
5349 | - if (ll_temac_reset_sdma(dev)) | ||
5350 | - return -1; | ||
5351 | - | ||
5352 | - ll_temac_init_sdma(dev); | ||
5353 | - } | ||
5354 | - | ||
5355 | - tx_dp->phys_buf_p = (u8 *)packet; | ||
5356 | - tx_dp->buf_len = length; | ||
5357 | - tx_dp->sca.stctrl = CDMAC_BD_STCTRL_SOP | CDMAC_BD_STCTRL_EOP | | ||
5358 | - CDMAC_BD_STCTRL_STOP_ON_END; | ||
5359 | - | ||
5360 | - flush_cache((u32)packet, length); | ||
5361 | - flush_cache((u32)tx_dp, sizeof(*tx_dp)); | ||
5362 | - | ||
5363 | - /* DMA start by writing to respective TAILDESC_PTR */ | ||
5364 | - ll_temac->out32(ra[TX_CURDESC_PTR], (int)tx_dp); | ||
5365 | - ll_temac->out32(ra[TX_TAILDESC_PTR], (int)tx_dp); | ||
5366 | - | ||
5367 | - /* Find next empty buffer descriptor, preparation for next iteration */ | ||
5368 | - tx_idx = (tx_idx + 1) % TX_BUF_CNT; | ||
5369 | - tx_dp = &cdmac_bd.tx[tx_idx]; | ||
5370 | - | ||
5371 | - do { | ||
5372 | - flush_cache((u32)tx_dp, sizeof(*tx_dp)); | ||
5373 | - udelay(1); | ||
5374 | - } while (timeout-- && !(tx_dp->sca.stctrl & CDMAC_BD_STCTRL_COMPLETED)); | ||
5375 | - | ||
5376 | - if (!timeout) { | ||
5377 | - printf("%s: Timeout\n", __func__); | ||
5378 | - return -1; | ||
5379 | - } | ||
5380 | - | ||
5381 | - return 0; | ||
5382 | -} | ||
5383 | diff --git a/drivers/net/xilinx_ll_temac_sdma.h b/drivers/net/xilinx_ll_temac_sdma.h | ||
5384 | deleted file mode 100644 | ||
5385 | index db00a57..0000000 | ||
5386 | --- a/drivers/net/xilinx_ll_temac_sdma.h | ||
5387 | +++ /dev/null | ||
5388 | @@ -1,280 +0,0 @@ | ||
5389 | -/* | ||
5390 | - * Xilinx xps_ll_temac ethernet driver for u-boot | ||
5391 | - * | ||
5392 | - * SDMA sub-controller interface | ||
5393 | - * | ||
5394 | - * Copyright (C) 2011 - 2012 Stephan Linz <linz@li-pro.net> | ||
5395 | - * Copyright (C) 2008 - 2011 Michal Simek <monstr@monstr.eu> | ||
5396 | - * Copyright (C) 2008 - 2011 PetaLogix | ||
5397 | - * | ||
5398 | - * Based on Yoshio Kashiwagi kashiwagi@co-nss.co.jp driver | ||
5399 | - * Copyright (C) 2008 Nissin Systems Co.,Ltd. | ||
5400 | - * March 2008 created | ||
5401 | - * | ||
5402 | - * This program is free software; you can redistribute it and/or modify it | ||
5403 | - * under the terms of the GNU General Public License as published by the | ||
5404 | - * Free Software Foundation; either version 2 of the License, or (at your | ||
5405 | - * option) any later version. | ||
5406 | - * | ||
5407 | - * [0]: http://www.xilinx.com/support/documentation | ||
5408 | - * | ||
5409 | - * [S]: [0]/ip_documentation/xps_ll_temac.pdf | ||
5410 | - * [A]: [0]/application_notes/xapp1041.pdf | ||
5411 | - */ | ||
5412 | -#ifndef _XILINX_LL_TEMAC_SDMA_ | ||
5413 | -#define _XILINX_LL_TEMAC_SDMA_ | ||
5414 | - | ||
5415 | -#include <net.h> | ||
5416 | - | ||
5417 | -#include <asm/types.h> | ||
5418 | -#include <asm/byteorder.h> | ||
5419 | - | ||
5420 | -#include <linux/compiler.h> | ||
5421 | - | ||
5422 | -#if !defined(__BIG_ENDIAN) | ||
5423 | -# error LL_TEMAC requires big endianess | ||
5424 | -#endif | ||
5425 | - | ||
5426 | -/* | ||
5427 | - * DMA Buffer Descriptor for CDMAC | ||
5428 | - * | ||
5429 | - * Used for data connection from and to (Rx/Tx) the LocalLink (LL) TEMAC via | ||
5430 | - * the Communications Direct Memory Access Controller (CDMAC) -- one for each. | ||
5431 | - * | ||
5432 | - * overview: | ||
5433 | - * ftp://ftp.xilinx.com/pub/documentation/misc/mpmc_getting_started.pdf | ||
5434 | - * | ||
5435 | - * [1]: [0]/ip_documentation/mpmc.pdf | ||
5436 | - * page 140, DMA Operation Descriptors | ||
5437 | - * | ||
5438 | - * [2]: [0]/user_guides/ug200.pdf | ||
5439 | - * page 229, DMA Controller -- Descriptor Format | ||
5440 | - * | ||
5441 | - * [3]: [0]/ip_documentation/xps_ll_temac.pdf | ||
5442 | - * page 72, Transmit LocalLink Frame Format | ||
5443 | - * page 73, Receive LocalLink Frame Format | ||
5444 | - */ | ||
5445 | -struct cdmac_bd { | ||
5446 | - struct cdmac_bd *next_p; /* Next Descriptor Pointer */ | ||
5447 | - u8 *phys_buf_p; /* Buffer Address */ | ||
5448 | - u32 buf_len; /* Buffer Length */ | ||
5449 | - union { | ||
5450 | - u8 stctrl; /* Status/Control the DMA transfer */ | ||
5451 | - u32 app[5]; /* application specific data */ | ||
5452 | - } __packed __aligned(1) sca; | ||
5453 | -}; | ||
5454 | - | ||
5455 | -/* CDMAC Descriptor Status and Control (stctrl), [1] p140, [2] p230 */ | ||
5456 | -#define CDMAC_BD_STCTRL_ERROR (1 << 7) | ||
5457 | -#define CDMAC_BD_STCTRL_IRQ_ON_END (1 << 6) | ||
5458 | -#define CDMAC_BD_STCTRL_STOP_ON_END (1 << 5) | ||
5459 | -#define CDMAC_BD_STCTRL_COMPLETED (1 << 4) | ||
5460 | -#define CDMAC_BD_STCTRL_SOP (1 << 3) | ||
5461 | -#define CDMAC_BD_STCTRL_EOP (1 << 2) | ||
5462 | -#define CDMAC_BD_STCTRL_DMACHBUSY (1 << 1) | ||
5463 | - | ||
5464 | -/* CDMAC Descriptor APP0: Transmit LocalLink Footer Word 3, [3] p72 */ | ||
5465 | -#define CDMAC_BD_APP0_TXCSCNTRL (1 << 0) | ||
5466 | - | ||
5467 | -/* CDMAC Descriptor APP1: Transmit LocalLink Footer Word 4, [3] p73 */ | ||
5468 | -#define CDMAC_BD_APP1_TXCSBEGIN_POS 16 | ||
5469 | -#define CDMAC_BD_APP1_TXCSBEGIN_MASK (0xFFFF << CDMAC_BD_APP1_TXCSBEGIN_POS) | ||
5470 | -#define CDMAC_BD_APP1_TXCSINSERT_POS 0 | ||
5471 | -#define CDMAC_BD_APP1_TXCSINSERT_MASK (0xFFFF << CDMAC_BD_APP1_TXCSINSERT_POS) | ||
5472 | - | ||
5473 | -/* CDMAC Descriptor APP2: Transmit LocalLink Footer Word 5, [3] p73 */ | ||
5474 | -#define CDMAC_BD_APP2_TXCSINIT_POS 0 | ||
5475 | -#define CDMAC_BD_APP2_TXCSINIT_MASK (0xFFFF << CDMAC_BD_APP2_TXCSINIT_POS) | ||
5476 | - | ||
5477 | -/* CDMAC Descriptor APP0: Receive LocalLink Footer Word 3, [3] p73 */ | ||
5478 | -#define CDMAC_BD_APP0_MADDRU_POS 0 | ||
5479 | -#define CDMAC_BD_APP0_MADDRU_MASK (0xFFFF << CDMAC_BD_APP0_MADDRU_POS) | ||
5480 | - | ||
5481 | -/* CDMAC Descriptor APP1: Receive LocalLink Footer Word 4, [3] p74 */ | ||
5482 | -#define CDMAC_BD_APP1_MADDRL_POS 0 | ||
5483 | -#define CDMAC_BD_APP1_MADDRL_MASK (~0UL << CDMAC_BD_APP1_MADDRL_POS) | ||
5484 | - | ||
5485 | -/* CDMAC Descriptor APP2: Receive LocalLink Footer Word 5, [3] p74 */ | ||
5486 | -#define CDMAC_BD_APP2_BCAST_FRAME (1 << 2) | ||
5487 | -#define CDMAC_BD_APP2_IPC_MCAST_FRAME (1 << 1) | ||
5488 | -#define CDMAC_BD_APP2_MAC_MCAST_FRAME (1 << 0) | ||
5489 | - | ||
5490 | -/* CDMAC Descriptor APP3: Receive LocalLink Footer Word 6, [3] p74 */ | ||
5491 | -#define CDMAC_BD_APP3_TLTPID_POS 16 | ||
5492 | -#define CDMAC_BD_APP3_TLTPID_MASK (0xFFFF << CDMAC_BD_APP3_TLTPID_POS) | ||
5493 | -#define CDMAC_BD_APP3_RXCSRAW_POS 0 | ||
5494 | -#define CDMAC_BD_APP3_RXCSRAW_MASK (0xFFFF << CDMAC_BD_APP3_RXCSRAW_POS) | ||
5495 | - | ||
5496 | -/* CDMAC Descriptor APP4: Receive LocalLink Footer Word 7, [3] p74 */ | ||
5497 | -#define CDMAC_BD_APP4_VLANTAG_POS 16 | ||
5498 | -#define CDMAC_BD_APP4_VLANTAG_MASK (0xFFFF << CDMAC_BD_APP4_VLANTAG_POS) | ||
5499 | -#define CDMAC_BD_APP4_RXBYTECNT_POS 0 | ||
5500 | -#define CDMAC_BD_APP4_RXBYTECNT_MASK (0x3FFF << CDMAC_BD_APP4_RXBYTECNT_POS) | ||
5501 | - | ||
5502 | -/* | ||
5503 | - * SDMA Register Definition | ||
5504 | - * | ||
5505 | - * [0]: http://www.xilinx.com/support/documentation | ||
5506 | - * | ||
5507 | - * [1]: [0]/ip_documentation/mpmc.pdf | ||
5508 | - * page 54, SDMA Register Summary | ||
5509 | - * page 160, SDMA Registers | ||
5510 | - * | ||
5511 | - * [2]: [0]/user_guides/ug200.pdf | ||
5512 | - * page 244, DMA Controller -- Programming Interface and Registers | ||
5513 | - */ | ||
5514 | -#define SDMA_CTRL_REGTYPE u32 | ||
5515 | -#define SDMA_CTRL_REGSIZE sizeof(SDMA_CTRL_REGTYPE) | ||
5516 | -struct sdma_ctrl { | ||
5517 | - /* Transmit Registers */ | ||
5518 | - SDMA_CTRL_REGTYPE tx_nxtdesc_ptr; /* TX Next Description Pointer */ | ||
5519 | - SDMA_CTRL_REGTYPE tx_curbuf_addr; /* TX Current Buffer Address */ | ||
5520 | - SDMA_CTRL_REGTYPE tx_curbuf_length; /* TX Current Buffer Length */ | ||
5521 | - SDMA_CTRL_REGTYPE tx_curdesc_ptr; /* TX Current Descriptor Pointer */ | ||
5522 | - SDMA_CTRL_REGTYPE tx_taildesc_ptr; /* TX Tail Descriptor Pointer */ | ||
5523 | - SDMA_CTRL_REGTYPE tx_chnl_ctrl; /* TX Channel Control */ | ||
5524 | - SDMA_CTRL_REGTYPE tx_irq_reg; /* TX Interrupt Register */ | ||
5525 | - SDMA_CTRL_REGTYPE tx_chnl_sts; /* TX Status Register */ | ||
5526 | - /* Receive Registers */ | ||
5527 | - SDMA_CTRL_REGTYPE rx_nxtdesc_ptr; /* RX Next Descriptor Pointer */ | ||
5528 | - SDMA_CTRL_REGTYPE rx_curbuf_addr; /* RX Current Buffer Address */ | ||
5529 | - SDMA_CTRL_REGTYPE rx_curbuf_length; /* RX Current Buffer Length */ | ||
5530 | - SDMA_CTRL_REGTYPE rx_curdesc_ptr; /* RX Current Descriptor Pointer */ | ||
5531 | - SDMA_CTRL_REGTYPE rx_taildesc_ptr; /* RX Tail Descriptor Pointer */ | ||
5532 | - SDMA_CTRL_REGTYPE rx_chnl_ctrl; /* RX Channel Control */ | ||
5533 | - SDMA_CTRL_REGTYPE rx_irq_reg; /* RX Interrupt Register */ | ||
5534 | - SDMA_CTRL_REGTYPE rx_chnl_sts; /* RX Status Register */ | ||
5535 | - /* Control Registers */ | ||
5536 | - SDMA_CTRL_REGTYPE dma_control_reg; /* DMA Control Register */ | ||
5537 | -}; | ||
5538 | - | ||
5539 | -#define SDMA_CTRL_REGNUMS sizeof(struct sdma_ctrl)/SDMA_CTRL_REGSIZE | ||
5540 | - | ||
5541 | -/* | ||
5542 | - * DMAC Register Index Enumeration | ||
5543 | - * | ||
5544 | - * [2]: http://www.xilinx.com/support/documentation/user_guides/ug200.pdf | ||
5545 | - * page 244, DMA Controller -- Programming Interface and Registers | ||
5546 | - */ | ||
5547 | -enum dmac_ctrl { | ||
5548 | - /* Transmit Registers */ | ||
5549 | - TX_NXTDESC_PTR = 0, /* TX Next Description Pointer */ | ||
5550 | - TX_CURBUF_ADDR, /* TX Current Buffer Address */ | ||
5551 | - TX_CURBUF_LENGTH, /* TX Current Buffer Length */ | ||
5552 | - TX_CURDESC_PTR, /* TX Current Descriptor Pointer */ | ||
5553 | - TX_TAILDESC_PTR, /* TX Tail Descriptor Pointer */ | ||
5554 | - TX_CHNL_CTRL, /* TX Channel Control */ | ||
5555 | - TX_IRQ_REG, /* TX Interrupt Register */ | ||
5556 | - TX_CHNL_STS, /* TX Status Register */ | ||
5557 | - /* Receive Registers */ | ||
5558 | - RX_NXTDESC_PTR, /* RX Next Descriptor Pointer */ | ||
5559 | - RX_CURBUF_ADDR, /* RX Current Buffer Address */ | ||
5560 | - RX_CURBUF_LENGTH, /* RX Current Buffer Length */ | ||
5561 | - RX_CURDESC_PTR, /* RX Current Descriptor Pointer */ | ||
5562 | - RX_TAILDESC_PTR, /* RX Tail Descriptor Pointer */ | ||
5563 | - RX_CHNL_CTRL, /* RX Channel Control */ | ||
5564 | - RX_IRQ_REG, /* RX Interrupt Register */ | ||
5565 | - RX_CHNL_STS, /* RX Status Register */ | ||
5566 | - /* Control Registers */ | ||
5567 | - DMA_CONTROL_REG /* DMA Control Register */ | ||
5568 | -}; | ||
5569 | - | ||
5570 | -/* Rx/Tx Channel Control Register (*_chnl_ctrl), [1] p163, [2] p246/p252 */ | ||
5571 | -#define CHNL_CTRL_ITO_POS 24 | ||
5572 | -#define CHNL_CTRL_ITO_MASK (0xFF << CHNL_CTRL_ITO_POS) | ||
5573 | -#define CHNL_CTRL_IC_POS 16 | ||
5574 | -#define CHNL_CTRL_IC_MASK (0xFF << CHNL_CTRL_IC_POS) | ||
5575 | -#define CHNL_CTRL_MSBADDR_POS 12 | ||
5576 | -#define CHNL_CTRL_MSBADDR_MASK (0xF << CHNL_CTRL_MSBADDR_POS) | ||
5577 | -#define CHNL_CTRL_AME (1 << 11) | ||
5578 | -#define CHNL_CTRL_OBWC (1 << 10) | ||
5579 | -#define CHNL_CTRL_IOE (1 << 9) | ||
5580 | -#define CHNL_CTRL_LIC (1 << 8) | ||
5581 | -#define CHNL_CTRL_IE (1 << 7) | ||
5582 | -#define CHNL_CTRL_IEE (1 << 2) | ||
5583 | -#define CHNL_CTRL_IDE (1 << 1) | ||
5584 | -#define CHNL_CTRL_ICE (1 << 0) | ||
5585 | - | ||
5586 | -/* All interrupt enable bits */ | ||
5587 | -#define CHNL_CTRL_IRQ_MASK (CHNL_CTRL_IE | \ | ||
5588 | - CHNL_CTRL_IEE | \ | ||
5589 | - CHNL_CTRL_IDE | \ | ||
5590 | - CHNL_CTRL_ICE) | ||
5591 | - | ||
5592 | -/* Rx/Tx Interrupt Status Register (*_irq_reg), [1] p164, [2] p247/p253 */ | ||
5593 | -#define IRQ_REG_DTV_POS 24 | ||
5594 | -#define IRQ_REG_DTV_MASK (0xFF << IRQ_REG_DTV_POS) | ||
5595 | -#define IRQ_REG_CCV_POS 16 | ||
5596 | -#define IRQ_REG_CCV_MASK (0xFF << IRQ_REG_CCV_POS) | ||
5597 | -#define IRQ_REG_WRCQ_EMPTY (1 << 14) | ||
5598 | -#define IRQ_REG_CIC_POS 10 | ||
5599 | -#define IRQ_REG_CIC_MASK (0xF << IRQ_REG_CIC_POS) | ||
5600 | -#define IRQ_REG_DIC_POS 8 | ||
5601 | -#define IRQ_REG_DIC_MASK (3 << 8) | ||
5602 | -#define IRQ_REG_PLB_RD_NMI (1 << 4) | ||
5603 | -#define IRQ_REG_PLB_WR_NMI (1 << 3) | ||
5604 | -#define IRQ_REG_EI (1 << 2) | ||
5605 | -#define IRQ_REG_DI (1 << 1) | ||
5606 | -#define IRQ_REG_CI (1 << 0) | ||
5607 | - | ||
5608 | -/* All interrupt bits */ | ||
5609 | -#define IRQ_REG_IRQ_MASK (IRQ_REG_PLB_RD_NMI | \ | ||
5610 | - IRQ_REG_PLB_WR_NMI | \ | ||
5611 | - IRQ_REG_EI | IRQ_REG_DI | IRQ_REG_CI) | ||
5612 | - | ||
5613 | -/* Rx/Tx Channel Status Register (*_chnl_sts), [1] p165, [2] p249/p255 */ | ||
5614 | -#define CHNL_STS_ERROR_TAIL (1 << 21) | ||
5615 | -#define CHNL_STS_ERROR_CMP (1 << 20) | ||
5616 | -#define CHNL_STS_ERROR_ADDR (1 << 19) | ||
5617 | -#define CHNL_STS_ERROR_NXTP (1 << 18) | ||
5618 | -#define CHNL_STS_ERROR_CURP (1 << 17) | ||
5619 | -#define CHNL_STS_ERROR_BSYWR (1 << 16) | ||
5620 | -#define CHNL_STS_ERROR (1 << 7) | ||
5621 | -#define CHNL_STS_IOE (1 << 6) | ||
5622 | -#define CHNL_STS_SOE (1 << 5) | ||
5623 | -#define CHNL_STS_CMPLT (1 << 4) | ||
5624 | -#define CHNL_STS_SOP (1 << 3) | ||
5625 | -#define CHNL_STS_EOP (1 << 2) | ||
5626 | -#define CHNL_STS_EBUSY (1 << 1) | ||
5627 | - | ||
5628 | -/* DMA Control Register (dma_control_reg), [1] p166, [2] p256 */ | ||
5629 | -#define DMA_CONTROL_PLBED (1 << 5) | ||
5630 | -#define DMA_CONTROL_RXOCEID (1 << 4) | ||
5631 | -#define DMA_CONTROL_TXOCEID (1 << 3) | ||
5632 | -#define DMA_CONTROL_TPE (1 << 2) | ||
5633 | -#define DMA_CONTROL_RESET (1 << 0) | ||
5634 | - | ||
5635 | -#if defined(CONFIG_XILINX_440) || defined(CONFIG_XILINX_405) | ||
5636 | - | ||
5637 | -/* Xilinx Device Control Register (DCR) in/out accessors */ | ||
5638 | -unsigned ll_temac_xldcr_in32(phys_addr_t addr); | ||
5639 | -void ll_temac_xldcr_out32(phys_addr_t addr, unsigned value); | ||
5640 | - | ||
5641 | -/* collect all register addresses for Xilinx DCR in/out accessors */ | ||
5642 | -void ll_temac_collect_xldcr_sdma_reg_addr(struct eth_device *dev); | ||
5643 | - | ||
5644 | -#endif /* CONFIG_XILINX_440 || CONFIG_XILINX_405 */ | ||
5645 | - | ||
5646 | -/* Xilinx Processor Local Bus (PLB) in/out accessors */ | ||
5647 | -unsigned ll_temac_xlplb_in32(phys_addr_t base); | ||
5648 | -void ll_temac_xlplb_out32(phys_addr_t base, unsigned value); | ||
5649 | - | ||
5650 | -/* collect all register addresses for Xilinx PLB in/out accessors */ | ||
5651 | -void ll_temac_collect_xlplb_sdma_reg_addr(struct eth_device *dev); | ||
5652 | - | ||
5653 | -/* initialize both Rx/Tx buffer descriptors */ | ||
5654 | -int ll_temac_init_sdma(struct eth_device *dev); | ||
5655 | - | ||
5656 | -/* halt both Rx/Tx transfers */ | ||
5657 | -int ll_temac_halt_sdma(struct eth_device *dev); | ||
5658 | - | ||
5659 | -/* reset SDMA and IRQ, disable interrupts and errors */ | ||
5660 | -int ll_temac_reset_sdma(struct eth_device *dev); | ||
5661 | - | ||
5662 | -/* receive buffered data from SDMA (polling ISR) */ | ||
5663 | -int ll_temac_recv_sdma(struct eth_device *dev); | ||
5664 | - | ||
5665 | -/* send buffered data to SDMA */ | ||
5666 | -int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length); | ||
5667 | - | ||
5668 | -#endif /* _XILINX_LL_TEMAC_SDMA_ */ | ||
5669 | diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c | ||
5670 | index 3596065..bd1c8c0 100644 | ||
5671 | --- a/drivers/net/zynq_gem.c | ||
5672 | +++ b/drivers/net/zynq_gem.c | ||
5673 | @@ -33,10 +33,7 @@ | ||
5674 | #include <phy.h> | ||
5675 | #include <miiphy.h> | ||
5676 | #include <watchdog.h> | ||
5677 | - | ||
5678 | -#if !defined(CONFIG_PHYLIB) | ||
5679 | -# error XILINX_GEM_ETHERNET requires PHYLIB | ||
5680 | -#endif | ||
5681 | +#include <asm/arch/sys_proto.h> | ||
5682 | |||
5683 | /* Bit/mask specification */ | ||
5684 | #define ZYNQ_GEM_PHYMNTNC_OP_MASK 0x40020000 /* operation mask bits */ | ||
5685 | @@ -67,13 +64,14 @@ | ||
5686 | #define ZYNQ_GEM_NWCTRL_MDEN_MASK 0x00000010 /* Enable MDIO port */ | ||
5687 | #define ZYNQ_GEM_NWCTRL_STARTTX_MASK 0x00000200 /* Start tx (tx_go) */ | ||
5688 | |||
5689 | -#define ZYNQ_GEM_NWCFG_SPEED 0x00000001 /* 100 Mbps operation */ | ||
5690 | -#define ZYNQ_GEM_NWCFG_FDEN 0x00000002 /* Full Duplex mode */ | ||
5691 | -#define ZYNQ_GEM_NWCFG_FSREM 0x00020000 /* FCS removal */ | ||
5692 | +#define ZYNQ_GEM_NWCFG_SPEED100 0x000000001 /* 100 Mbps operation */ | ||
5693 | +#define ZYNQ_GEM_NWCFG_SPEED1000 0x000000400 /* 1Gbps operation */ | ||
5694 | +#define ZYNQ_GEM_NWCFG_FDEN 0x000000002 /* Full Duplex mode */ | ||
5695 | +#define ZYNQ_GEM_NWCFG_FSREM 0x000020000 /* FCS removal */ | ||
5696 | #define ZYNQ_GEM_NWCFG_MDCCLKDIV 0x000080000 /* Div pclk by 32, 80MHz */ | ||
5697 | +#define ZYNQ_GEM_NWCFG_MDCCLKDIV2 0x0000c0000 /* Div pclk by 48, 120MHz */ | ||
5698 | |||
5699 | -#define ZYNQ_GEM_NWCFG_INIT (ZYNQ_GEM_NWCFG_SPEED | \ | ||
5700 | - ZYNQ_GEM_NWCFG_FDEN | \ | ||
5701 | +#define ZYNQ_GEM_NWCFG_INIT (ZYNQ_GEM_NWCFG_FDEN | \ | ||
5702 | ZYNQ_GEM_NWCFG_FSREM | \ | ||
5703 | ZYNQ_GEM_NWCFG_MDCCLKDIV) | ||
5704 | |||
5705 | @@ -92,6 +90,17 @@ | ||
5706 | ZYNQ_GEM_DMACR_TXSIZE | \ | ||
5707 | ZYNQ_GEM_DMACR_RXBUF) | ||
5708 | |||
5709 | +/* Use MII register 1 (MII status register) to detect PHY */ | ||
5710 | +#define PHY_DETECT_REG 1 | ||
5711 | + | ||
5712 | +/* Mask used to verify certain PHY features (or register contents) | ||
5713 | + * in the register above: | ||
5714 | + * 0x1000: 10Mbps full duplex support | ||
5715 | + * 0x0800: 10Mbps half duplex support | ||
5716 | + * 0x0008: Auto-negotiation support | ||
5717 | + */ | ||
5718 | +#define PHY_DETECT_MASK 0x1808 | ||
5719 | + | ||
5720 | /* Device registers */ | ||
5721 | struct zynq_gem_regs { | ||
5722 | u32 nwctrl; /* Network Control reg */ | ||
5723 | @@ -134,6 +143,7 @@ struct zynq_gem_priv { | ||
5724 | u32 rxbd_current; | ||
5725 | u32 rx_first_buf; | ||
5726 | int phyaddr; | ||
5727 | + int init; | ||
5728 | struct phy_device *phydev; | ||
5729 | struct mii_dev *bus; | ||
5730 | }; | ||
5731 | @@ -141,7 +151,7 @@ struct zynq_gem_priv { | ||
5732 | static inline int mdio_wait(struct eth_device *dev) | ||
5733 | { | ||
5734 | struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase; | ||
5735 | - u32 timeout = 200; | ||
5736 | + u32 timeout = 20000; | ||
5737 | |||
5738 | /* Wait till MDIO interface is ready to accept a new transaction. */ | ||
5739 | while (--timeout) { | ||
5740 | @@ -196,6 +206,65 @@ static u32 phywrite(struct eth_device *dev, u32 phy_addr, u32 regnum, u16 data) | ||
5741 | ZYNQ_GEM_PHYMNTNC_OP_W_MASK, &data); | ||
5742 | } | ||
5743 | |||
5744 | +#ifndef CONFIG_PHYLIB | ||
5745 | +static int phy_rst(struct eth_device *dev) | ||
5746 | +{ | ||
5747 | + struct zynq_gem_priv *priv = dev->priv; | ||
5748 | + u16 tmp; | ||
5749 | + | ||
5750 | + puts("Resetting PHY...\n"); | ||
5751 | + phyread(dev, priv->phyaddr, 0, &tmp); | ||
5752 | + tmp |= 0x8000; | ||
5753 | + phywrite(dev, priv->phyaddr, 0, tmp); | ||
5754 | + | ||
5755 | + phyread(dev, priv->phyaddr, 0, &tmp); | ||
5756 | + while (tmp & 0x8000) { | ||
5757 | + putc('.'); | ||
5758 | + if (ctrlc()) | ||
5759 | + return 1; | ||
5760 | + phyread(dev, priv->phyaddr, 0, &tmp); | ||
5761 | + } | ||
5762 | + puts("\nPHY reset complete.\n"); | ||
5763 | + return 0; | ||
5764 | +} | ||
5765 | +#endif | ||
5766 | + | ||
5767 | +static void phy_detection(struct eth_device *dev) | ||
5768 | +{ | ||
5769 | + int i; | ||
5770 | + u16 phyreg; | ||
5771 | + struct zynq_gem_priv *priv = dev->priv; | ||
5772 | + | ||
5773 | + if (priv->phyaddr != -1 ) { | ||
5774 | + phyread(dev, priv->phyaddr, PHY_DETECT_REG, &phyreg); | ||
5775 | + if ((phyreg != 0xFFFF) && | ||
5776 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
5777 | + /* Found a valid PHY address */ | ||
5778 | + debug("Default phy address %d is valid\n", priv->phyaddr); | ||
5779 | + return; | ||
5780 | + } else { | ||
5781 | + debug("PHY address is not setup correctly %d\n", priv->phyaddr); | ||
5782 | + priv->phyaddr = -1; | ||
5783 | + } | ||
5784 | + } | ||
5785 | + | ||
5786 | + debug("detecting phy address\n"); | ||
5787 | + if (priv->phyaddr == -1 ) { | ||
5788 | + /* detect the PHY address */ | ||
5789 | + for (i = 31; i >= 0; i--) { | ||
5790 | + phyread(dev, i, PHY_DETECT_REG, &phyreg); | ||
5791 | + if ((phyreg != 0xFFFF) && | ||
5792 | + ((phyreg & PHY_DETECT_MASK) == PHY_DETECT_MASK)) { | ||
5793 | + /* Found a valid PHY address */ | ||
5794 | + priv->phyaddr = i; | ||
5795 | + debug("Found valid phy address, %d\n", i); | ||
5796 | + return; | ||
5797 | + } | ||
5798 | + } | ||
5799 | + } | ||
5800 | + printf("PHY is not detected\n"); | ||
5801 | +} | ||
5802 | + | ||
5803 | static int zynq_gem_setup_mac(struct eth_device *dev) | ||
5804 | { | ||
5805 | u32 i, macaddrlow, macaddrhigh; | ||
5806 | @@ -239,59 +308,132 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) | ||
5807 | SUPPORTED_1000baseT_Half | | ||
5808 | SUPPORTED_1000baseT_Full; | ||
5809 | |||
5810 | - /* Disable all interrupts */ | ||
5811 | - writel(0xFFFFFFFF, ®s->idr); | ||
5812 | - | ||
5813 | - /* Disable the receiver & transmitter */ | ||
5814 | - writel(0, ®s->nwctrl); | ||
5815 | - writel(0, ®s->txsr); | ||
5816 | - writel(0, ®s->rxsr); | ||
5817 | - writel(0, ®s->phymntnc); | ||
5818 | - | ||
5819 | - /* Clear the Hash registers for the mac address pointed by AddressPtr */ | ||
5820 | - writel(0x0, ®s->hashl); | ||
5821 | - /* Write bits [63:32] in TOP */ | ||
5822 | - writel(0x0, ®s->hashh); | ||
5823 | + if (!priv->init) { | ||
5824 | + /* Disable all interrupts */ | ||
5825 | + writel(0xFFFFFFFF, ®s->idr); | ||
5826 | + | ||
5827 | + /* Disable the receiver & transmitter */ | ||
5828 | + writel(0, ®s->nwctrl); | ||
5829 | + writel(0, ®s->txsr); | ||
5830 | + writel(0, ®s->rxsr); | ||
5831 | + writel(0, ®s->phymntnc); | ||
5832 | + | ||
5833 | + /* | ||
5834 | + * Clear the Hash registers for the mac address | ||
5835 | + * pointed by AddressPtr | ||
5836 | + */ | ||
5837 | + writel(0x0, ®s->hashl); | ||
5838 | + /* Write bits [63:32] in TOP */ | ||
5839 | + writel(0x0, ®s->hashh); | ||
5840 | + | ||
5841 | + /* Clear all counters */ | ||
5842 | + for (i = 0; i <= stat_size; i++) | ||
5843 | + readl(®s->stat[i]); | ||
5844 | + | ||
5845 | + /* Setup RxBD space */ | ||
5846 | + memset(&(priv->rx_bd), 0, sizeof(priv->rx_bd)); | ||
5847 | + /* Create the RxBD ring */ | ||
5848 | + memset(&(priv->rxbuffers), 0, sizeof(priv->rxbuffers)); | ||
5849 | + | ||
5850 | + for (i = 0; i < RX_BUF; i++) { | ||
5851 | + priv->rx_bd[i].status = 0xF0000000; | ||
5852 | + priv->rx_bd[i].addr = | ||
5853 | + (u32)((char *) &(priv->rxbuffers) + | ||
5854 | + (i * PKTSIZE_ALIGN)); | ||
5855 | + } | ||
5856 | + /* WRAP bit to last BD */ | ||
5857 | + priv->rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK; | ||
5858 | + /* Write RxBDs to IP */ | ||
5859 | + writel((u32) &(priv->rx_bd), ®s->rxqbase); | ||
5860 | |||
5861 | - /* Clear all counters */ | ||
5862 | - for (i = 0; i <= stat_size; i++) | ||
5863 | - readl(®s->stat[i]); | ||
5864 | + /* Setup for DMA Configuration register */ | ||
5865 | + writel(ZYNQ_GEM_DMACR_INIT, ®s->dmacr); | ||
5866 | |||
5867 | - /* Setup RxBD space */ | ||
5868 | - memset(&(priv->rx_bd), 0, sizeof(priv->rx_bd)); | ||
5869 | - /* Create the RxBD ring */ | ||
5870 | - memset(&(priv->rxbuffers), 0, sizeof(priv->rxbuffers)); | ||
5871 | + /* Setup for Network Control register, MDIO, Rx and Tx enable */ | ||
5872 | + setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_MDEN_MASK); | ||
5873 | |||
5874 | - for (i = 0; i < RX_BUF; i++) { | ||
5875 | - priv->rx_bd[i].status = 0xF0000000; | ||
5876 | - priv->rx_bd[i].addr = (u32)((char *) &(priv->rxbuffers) + | ||
5877 | - (i * PKTSIZE_ALIGN)); | ||
5878 | + priv->init++; | ||
5879 | } | ||
5880 | - /* WRAP bit to last BD */ | ||
5881 | - priv->rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK; | ||
5882 | - /* Write RxBDs to IP */ | ||
5883 | - writel((u32) &(priv->rx_bd), ®s->rxqbase); | ||
5884 | |||
5885 | - /* MAC Setup */ | ||
5886 | - /* Setup Network Configuration register */ | ||
5887 | - writel(ZYNQ_GEM_NWCFG_INIT, ®s->nwcfg); | ||
5888 | + phy_detection(dev); | ||
5889 | |||
5890 | - /* Setup for DMA Configuration register */ | ||
5891 | - writel(ZYNQ_GEM_DMACR_INIT, ®s->dmacr); | ||
5892 | - | ||
5893 | - /* Setup for Network Control register, MDIO, Rx and Tx enable */ | ||
5894 | - setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_MDEN_MASK | | ||
5895 | - ZYNQ_GEM_NWCTRL_RXEN_MASK | ZYNQ_GEM_NWCTRL_TXEN_MASK); | ||
5896 | +#ifdef CONFIG_PHYLIB | ||
5897 | + u32 rclk, clk = 0; | ||
5898 | |||
5899 | /* interface - look at tsec */ | ||
5900 | phydev = phy_connect(priv->bus, priv->phyaddr, dev, 0); | ||
5901 | |||
5902 | - phydev->supported &= supported; | ||
5903 | + phydev->supported = supported | ADVERTISED_Pause | ADVERTISED_Asym_Pause; | ||
5904 | phydev->advertising = phydev->supported; | ||
5905 | priv->phydev = phydev; | ||
5906 | phy_config(phydev); | ||
5907 | phy_startup(phydev); | ||
5908 | |||
5909 | + switch(phydev->speed) { | ||
5910 | + case SPEED_1000: | ||
5911 | + writel(ZYNQ_GEM_NWCFG_INIT | ZYNQ_GEM_NWCFG_SPEED1000, | ||
5912 | + ®s->nwcfg); | ||
5913 | + rclk = (0 << 4) | (1 << 0); | ||
5914 | + clk = (1 << 20) | (8 << 8) | (0 << 4) | (1 << 0); | ||
5915 | + break; | ||
5916 | + case SPEED_100: | ||
5917 | + clrsetbits_le32(®s->nwcfg, ZYNQ_GEM_NWCFG_SPEED1000, | ||
5918 | + ZYNQ_GEM_NWCFG_INIT | ZYNQ_GEM_NWCFG_SPEED100); | ||
5919 | + rclk = 1 << 0; | ||
5920 | + clk = (5 << 20) | (8 << 8) | (0 << 4) | (1 << 0); | ||
5921 | + break; | ||
5922 | + case SPEED_10: | ||
5923 | + rclk = 1 << 0; | ||
5924 | + /* FIXME untested */ | ||
5925 | + clk = (5 << 20) | (8 << 8) | (0 << 4) | (1 << 0); | ||
5926 | + break; | ||
5927 | + } | ||
5928 | + /* FIXME maybe better to define gem address in hardware.h */ | ||
5929 | + zynq_slcr_gem_clk_setup(dev->iobase != 0xE000B000, rclk, clk); | ||
5930 | + | ||
5931 | +#else | ||
5932 | + /* PHY Setup */ | ||
5933 | + phywrite(dev, priv->phyaddr, 22, 2); /* page 2 */ | ||
5934 | + | ||
5935 | + /* rx clock transition when data stable */ | ||
5936 | + phywrite(dev, priv->phyaddr, 21, 0x3030); | ||
5937 | + | ||
5938 | + phywrite(dev, priv->phyaddr, 22, 0); /* page 0 */ | ||
5939 | + | ||
5940 | + u16 tmp; | ||
5941 | + | ||
5942 | + /* link speed advertisement for autonegotiation */ | ||
5943 | + phyread(dev, priv->phyaddr, 4, &tmp); | ||
5944 | + tmp |= 0xd80; /* enable 100Mbps */ | ||
5945 | + tmp &= ~0x60; /* disable 10 Mbps */ | ||
5946 | + phywrite(dev, priv->phyaddr, 4, tmp); | ||
5947 | + | ||
5948 | + /* *disable* gigabit advertisement */ | ||
5949 | + phyread(dev, priv->phyaddr, 9, &tmp); | ||
5950 | + tmp &= ~0x0300; | ||
5951 | + phywrite(dev, priv->phyaddr, 9, tmp); | ||
5952 | + | ||
5953 | + /* enable autonegotiation, set 100Mbps, full-duplex, restart aneg */ | ||
5954 | + phyread(dev, priv->phyaddr, 0, &tmp); | ||
5955 | + phywrite(dev, priv->phyaddr, 0, 0x3300 | (tmp & 0x1F)); | ||
5956 | + | ||
5957 | + if (phy_rst(dev)) | ||
5958 | + return -1; | ||
5959 | + | ||
5960 | + puts("\nWaiting for PHY to complete autonegotiation."); | ||
5961 | + do { | ||
5962 | + phyread(dev, priv->phyaddr, 1, &tmp); | ||
5963 | + } while (tmp & (1 << 5)); | ||
5964 | + | ||
5965 | + puts("\nPHY claims autonegotiation complete...\n"); | ||
5966 | + | ||
5967 | + puts("GEM link speed is 100Mbps\n"); | ||
5968 | + writel(ZYNQ_GEM_NWCFG_INIT | ZYNQ_GEM_NWCFG_SPEED100, ®s->nwcfg); | ||
5969 | +#endif | ||
5970 | + | ||
5971 | + setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_RXEN_MASK | | ||
5972 | + ZYNQ_GEM_NWCTRL_TXEN_MASK); | ||
5973 | + | ||
5974 | return 0; | ||
5975 | } | ||
5976 | |||
5977 | @@ -310,8 +452,7 @@ static int zynq_gem_send(struct eth_device *dev, void *ptr, int len) | ||
5978 | memset((void *) &(priv->tx_bd), 0, sizeof(struct emac_bd)); | ||
5979 | |||
5980 | priv->tx_bd.addr = (u32)ptr; | ||
5981 | - priv->tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK | | ||
5982 | - ZYNQ_GEM_TXBUF_WRAP_MASK; | ||
5983 | + priv->tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK; | ||
5984 | |||
5985 | /* Start transmit */ | ||
5986 | setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_STARTTX_MASK); | ||
5987 | @@ -364,19 +505,17 @@ static int zynq_gem_recv(struct eth_device *dev) | ||
5988 | |||
5989 | if ((++priv->rxbd_current) >= RX_BUF) | ||
5990 | priv->rxbd_current = 0; | ||
5991 | - | ||
5992 | - return frame_len; | ||
5993 | } | ||
5994 | |||
5995 | - return 0; | ||
5996 | + return frame_len; | ||
5997 | } | ||
5998 | |||
5999 | static void zynq_gem_halt(struct eth_device *dev) | ||
6000 | { | ||
6001 | struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase; | ||
6002 | |||
6003 | - /* Disable the receiver & transmitter */ | ||
6004 | - writel(0, ®s->nwctrl); | ||
6005 | + clrsetbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_RXEN_MASK | | ||
6006 | + ZYNQ_GEM_NWCTRL_TXEN_MASK, 0); | ||
6007 | } | ||
6008 | |||
6009 | static int zynq_gem_miiphyread(const char *devname, uchar addr, | ||
6010 | @@ -433,8 +572,10 @@ int zynq_gem_initialize(bd_t *bis, int base_addr) | ||
6011 | |||
6012 | eth_register(dev); | ||
6013 | |||
6014 | +#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB) | ||
6015 | miiphy_register(dev->name, zynq_gem_miiphyread, zynq_gem_miiphy_write); | ||
6016 | priv->bus = miiphy_get_dev_by_name(dev->name); | ||
6017 | +#endif | ||
6018 | |||
6019 | return 1; | ||
6020 | } | ||
6021 | diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c | ||
6022 | index 7b5ecb5..c217c88 100644 | ||
6023 | --- a/drivers/serial/arm_dcc.c | ||
6024 | +++ b/drivers/serial/arm_dcc.c | ||
6025 | @@ -89,15 +89,6 @@ | ||
6026 | |||
6027 | #define TIMEOUT_COUNT 0x4000000 | ||
6028 | |||
6029 | -#ifndef CONFIG_ARM_DCC_MULTI | ||
6030 | -#define arm_dcc_init serial_init | ||
6031 | -void serial_setbrg(void) {} | ||
6032 | -#define arm_dcc_getc serial_getc | ||
6033 | -#define arm_dcc_putc serial_putc | ||
6034 | -#define arm_dcc_puts serial_puts | ||
6035 | -#define arm_dcc_tstc serial_tstc | ||
6036 | -#endif | ||
6037 | - | ||
6038 | int arm_dcc_init(void) | ||
6039 | { | ||
6040 | return 0; | ||
6041 | @@ -147,16 +138,10 @@ int arm_dcc_tstc(void) | ||
6042 | return reg; | ||
6043 | } | ||
6044 | |||
6045 | -#ifdef CONFIG_ARM_DCC_MULTI | ||
6046 | static struct stdio_dev arm_dcc_dev; | ||
6047 | |||
6048 | int drv_arm_dcc_init(void) | ||
6049 | { | ||
6050 | - int rc; | ||
6051 | - | ||
6052 | - /* Device initialization */ | ||
6053 | - memset(&arm_dcc_dev, 0, sizeof(arm_dcc_dev)); | ||
6054 | - | ||
6055 | strcpy(arm_dcc_dev.name, "dcc"); | ||
6056 | arm_dcc_dev.ext = 0; /* No extensions */ | ||
6057 | arm_dcc_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_OUTPUT; | ||
6058 | @@ -167,4 +152,8 @@ int drv_arm_dcc_init(void) | ||
6059 | |||
6060 | return stdio_register(&arm_dcc_dev); | ||
6061 | } | ||
6062 | -#endif | ||
6063 | + | ||
6064 | +__weak struct serial_device *default_serial_console(void) | ||
6065 | +{ | ||
6066 | + return NULL; | ||
6067 | +} | ||
6068 | diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile | ||
6069 | index 824d357..0f324f4 100644 | ||
6070 | --- a/drivers/spi/Makefile | ||
6071 | +++ b/drivers/spi/Makefile | ||
6072 | @@ -47,6 +47,7 @@ COBJS-$(CONFIG_SH_SPI) += sh_spi.o | ||
6073 | COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o | ||
6074 | COBJS-$(CONFIG_TEGRA_SPI) += tegra_spi.o | ||
6075 | COBJS-$(CONFIG_XILINX_SPI) += xilinx_spi.o | ||
6076 | +COBJS-$(CONFIG_ZYNQ_SPI) += zynq_qspips.o | ||
6077 | |||
6078 | COBJS := $(COBJS-y) | ||
6079 | SRCS := $(COBJS:.o=.c) | ||
6080 | diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c | ||
6081 | index 52a4134..db01cc2 100644 | ||
6082 | --- a/drivers/spi/xilinx_spi.c | ||
6083 | +++ b/drivers/spi/xilinx_spi.c | ||
6084 | @@ -99,6 +99,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, | ||
6085 | debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__, | ||
6086 | bus, cs, xilspi->regs, xilspi->mode, xilspi->freq); | ||
6087 | |||
6088 | + writel(SPISSR_RESET_VALUE, &xilspi->regs->srr); | ||
6089 | + | ||
6090 | return &xilspi->slave; | ||
6091 | } | ||
6092 | |||
6093 | diff --git a/drivers/spi/xilinx_spi.h b/drivers/spi/xilinx_spi.h | ||
6094 | index 32610d2..69d0b94 100644 | ||
6095 | --- a/drivers/spi/xilinx_spi.h | ||
6096 | +++ b/drivers/spi/xilinx_spi.h | ||
6097 | @@ -119,6 +119,9 @@ struct xilinx_spi_reg { | ||
6098 | #define SPIRFOR_OCYVAL_POS 0 | ||
6099 | #define SPIRFOR_OCYVAL_MASK (0xf << SPIRFOR_OCYVAL_POS) | ||
6100 | |||
6101 | +/* SPI Software Reset Register (ssr) */ | ||
6102 | +#define SPISSR_RESET_VALUE 0x0a | ||
6103 | + | ||
6104 | struct xilinx_spi_slave { | ||
6105 | struct spi_slave slave; | ||
6106 | struct xilinx_spi_reg *regs; | ||
6107 | diff --git a/drivers/spi/zynq_qspips.c b/drivers/spi/zynq_qspips.c | ||
6108 | new file mode 100644 | ||
6109 | index 0000000..46a2b62 | ||
6110 | --- /dev/null | ||
6111 | +++ b/drivers/spi/zynq_qspips.c | ||
6112 | @@ -0,0 +1,1056 @@ | ||
6113 | +/* | ||
6114 | + * (C) Copyright 2011 Xilinx | ||
6115 | + * | ||
6116 | + * Xilinx PS Quad-SPI (QSPI) controller driver (master mode only) | ||
6117 | + * based on Xilinx PS SPI Driver (xspips.c) | ||
6118 | + * | ||
6119 | + * This program is free software; you can redistribute it and/or modify it under | ||
6120 | + * the terms of the GNU General Public License version 2 as published by the | ||
6121 | + * Free Software Foundation; either version 2 of the License, or (at your | ||
6122 | + * option) any later version. | ||
6123 | + * | ||
6124 | + * You should have received a copy of the GNU General Public License along with | ||
6125 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
6126 | + * Place, Suite 330, Boston, MA 02111-1307 USA | ||
6127 | + */ | ||
6128 | + | ||
6129 | +#include <common.h> | ||
6130 | +#include <malloc.h> | ||
6131 | +#include <ubi_uboot.h> | ||
6132 | +#include <spi.h> | ||
6133 | +#include <asm/io.h> | ||
6134 | +#include <asm/arch/sys_proto.h> | ||
6135 | + | ||
6136 | +/* QSPI Transmit Data Register */ | ||
6137 | +#define XQSPIPS_TXD_00_00_OFFSET 0x1C /* Transmit 4-byte inst, WO */ | ||
6138 | +#define XQSPIPS_TXD_00_01_OFFSET 0x80 /* Transmit 1-byte inst, WO */ | ||
6139 | +#define XQSPIPS_TXD_00_10_OFFSET 0x84 /* Transmit 2-byte inst, WO */ | ||
6140 | +#define XQSPIPS_TXD_00_11_OFFSET 0x88 /* Transmit 3-byte inst, WO */ | ||
6141 | + | ||
6142 | +/* | ||
6143 | + * QSPI Configuration Register bit Masks | ||
6144 | + * | ||
6145 | + * This register contains various control bits that effect the operation | ||
6146 | + * of the QSPI controller | ||
6147 | + */ | ||
6148 | +#define XQSPIPS_CONFIG_MANSRT_MASK 0x00010000 /* Manual TX Start */ | ||
6149 | +#define XQSPIPS_CONFIG_CPHA_MASK 0x00000004 /* Clock Phase Control */ | ||
6150 | +#define XQSPIPS_CONFIG_CPOL_MASK 0x00000002 /* Clock Polarity Control */ | ||
6151 | +#define XQSPIPS_CONFIG_SSCTRL_MASK 0x00003C00 /* Slave Select Mask */ | ||
6152 | + | ||
6153 | +/* | ||
6154 | + * QSPI Interrupt Registers bit Masks | ||
6155 | + * | ||
6156 | + * All the four interrupt registers (Status/Mask/Enable/Disable) have the same | ||
6157 | + * bit definitions. | ||
6158 | + */ | ||
6159 | +#define XQSPIPS_IXR_TXNFULL_MASK 0x00000004 /* QSPI TX FIFO Overflow */ | ||
6160 | +#define XQSPIPS_IXR_TXFULL_MASK 0x00000008 /* QSPI TX FIFO is full */ | ||
6161 | +#define XQSPIPS_IXR_RXNEMTY_MASK 0x00000010 /* QSPI RX FIFO Not Empty */ | ||
6162 | +#define XQSPIPS_IXR_ALL_MASK (XQSPIPS_IXR_TXNFULL_MASK | \ | ||
6163 | + XQSPIPS_IXR_RXNEMTY_MASK) | ||
6164 | + | ||
6165 | +/* | ||
6166 | + * QSPI Enable Register bit Masks | ||
6167 | + * | ||
6168 | + * This register is used to enable or disable the QSPI controller | ||
6169 | + */ | ||
6170 | +#define XQSPIPS_ENABLE_ENABLE_MASK 0x00000001 /* QSPI Enable Bit Mask */ | ||
6171 | + | ||
6172 | +/* | ||
6173 | + * QSPI Linear Configuration Register | ||
6174 | + * | ||
6175 | + * It is named Linear Configuration but it controls other modes when not in | ||
6176 | + * linear mode also. | ||
6177 | + */ | ||
6178 | +#define XQSPIPS_LCFG_TWO_MEM_MASK 0x40000000 /* QSPI Enable Bit Mask */ | ||
6179 | +#define XQSPIPS_LCFG_SEP_BUS_MASK 0x20000000 /* QSPI Enable Bit Mask */ | ||
6180 | +#define XQSPIPS_LCFG_U_PAGE 0x8000000 /* QSPI Upper memory set */ | ||
6181 | + | ||
6182 | +#define XQSPIPS_LCFG_DUMMY_SHIFT 8 | ||
6183 | + | ||
6184 | +#define XQSPIPS_FAST_READ_QOUT_CODE 0x6B /* read instruction code */ | ||
6185 | + | ||
6186 | +/* | ||
6187 | + * The modebits configurable by the driver to make the SPI support different | ||
6188 | + * data formats | ||
6189 | + */ | ||
6190 | +#define MODEBITS (SPI_CPOL | SPI_CPHA) | ||
6191 | + | ||
6192 | +/* Definitions for the status of queue */ | ||
6193 | +#define XQSPIPS_QUEUE_STOPPED 0 | ||
6194 | +#define XQSPIPS_QUEUE_RUNNING 1 | ||
6195 | + | ||
6196 | +/* QSPI MIO's count for different connection topologies */ | ||
6197 | +#define XQSPIPS_MIO_NUM_QSPI0 6 | ||
6198 | +#define XQSPIPS_MIO_NUM_QSPI1 5 | ||
6199 | +#define XQSPIPS_MIO_NUM_QSPI1_CS 1 | ||
6200 | + | ||
6201 | +/* QSPI connections topology */ | ||
6202 | +enum xqspips_con_topology { | ||
6203 | + MODE_UNKNOWN = -1, | ||
6204 | + MODE_SINGLE, | ||
6205 | + MODE_DUAL_PARALLEL, | ||
6206 | + MODE_DUAL_STACKED, | ||
6207 | +}; | ||
6208 | + | ||
6209 | +/* Definitions of the flash commands - Flash opcodes in ascending order */ | ||
6210 | +#define XQSPIPS_FLASH_OPCODE_WRSR 0x01 /* Write status register */ | ||
6211 | +#define XQSPIPS_FLASH_OPCODE_PP 0x02 /* Page program */ | ||
6212 | +#define XQSPIPS_FLASH_OPCODE_NORM_READ 0x03 /* Normal read data bytes */ | ||
6213 | +#define XQSPIPS_FLASH_OPCODE_WRDS 0x04 /* Write disable */ | ||
6214 | +#define XQSPIPS_FLASH_OPCODE_RDSR1 0x05 /* Read status register 1 */ | ||
6215 | +#define XQSPIPS_FLASH_OPCODE_WREN 0x06 /* Write enable */ | ||
6216 | +#define XQSPIPS_FLASH_OPCODE_FAST_READ 0x0B /* Fast read data bytes */ | ||
6217 | +#define XQSPIPS_FLASH_OPCODE_BRRD 0x16 /* Bank address reg read */ | ||
6218 | +#define XQSPIPS_FLASH_OPCODE_BRWR 0x17 /* Bank address reg write */ | ||
6219 | +#define XQSPIPS_FLASH_OPCODE_BE_4K 0x20 /* Erase 4KiB block */ | ||
6220 | +#define XQSPIPS_FLASH_OPCODE_RDSR2 0x35 /* Read status register 2 */ | ||
6221 | +#define XQSPIPS_FLASH_OPCODE_DUAL_READ 0x3B /* Dual read data bytes */ | ||
6222 | +#define XQSPIPS_FLASH_OPCODE_BE_32K 0x52 /* Erase 32KiB block */ | ||
6223 | +#define XQSPIPS_FLASH_OPCODE_QUAD_READ 0x6B /* Quad read data bytes */ | ||
6224 | +#define XQSPIPS_FLASH_OPCODE_ERASE_SUS 0x75 /* Erase suspend */ | ||
6225 | +#define XQSPIPS_FLASH_OPCODE_ERASE_RES 0x7A /* Erase resume */ | ||
6226 | +#define XQSPIPS_FLASH_OPCODE_RDID 0x9F /* Read JEDEC ID */ | ||
6227 | +#define XQSPIPS_FLASH_OPCODE_BE 0xC7 /* Erase whole flash block */ | ||
6228 | +#define XQSPIPS_FLASH_OPCODE_SE 0xD8 /* Sector erase (usually 64KB)*/ | ||
6229 | + | ||
6230 | +/* Few mtd flash functions */ | ||
6231 | +extern int spi_flash_cmd(struct spi_slave *spi, u8 cmd, | ||
6232 | + void *response, size_t len); | ||
6233 | +extern int spi_flash_cmd_read(struct spi_slave *spi, const u8 *cmd, | ||
6234 | + size_t cmd_len, void *data, size_t data_len); | ||
6235 | + | ||
6236 | +/* QSPI register offsets */ | ||
6237 | +struct xqspips_regs { | ||
6238 | + u32 confr; /* 0x00 */ | ||
6239 | + u32 isr; /* 0x04 */ | ||
6240 | + u32 ier; /* 0x08 */ | ||
6241 | + u32 idisr; /* 0x0C */ | ||
6242 | + u32 imaskr; /* 0x10 */ | ||
6243 | + u32 enbr; /* 0x14 */ | ||
6244 | + u32 dr; /* 0x18 */ | ||
6245 | + u32 txd0r; /* 0x1C */ | ||
6246 | + u32 drxr; /* 0x20 */ | ||
6247 | + u32 sicr; /* 0x24 */ | ||
6248 | + u32 txftr; /* 0x28 */ | ||
6249 | + u32 rxftr; /* 0x2C */ | ||
6250 | + u32 gpior; /* 0x30 */ | ||
6251 | + u32 reserved0[19]; | ||
6252 | + u32 txd1r; /* 0x80 */ | ||
6253 | + u32 txd2r; /* 0x84 */ | ||
6254 | + u32 txd3r; /* 0x88 */ | ||
6255 | + u32 reserved1[5]; | ||
6256 | + u32 lcr; /* 0xA0 */ | ||
6257 | + u32 reserved2[22]; | ||
6258 | + u32 midr; /* 0xFC */ | ||
6259 | +}; | ||
6260 | + | ||
6261 | +#define xqspips_base ((struct xqspips_regs *) XPSS_QSPI_BASEADDR) | ||
6262 | + | ||
6263 | +struct xqspips { | ||
6264 | + u32 input_clk_hz; | ||
6265 | + u32 speed_hz; | ||
6266 | + const void *txbuf; | ||
6267 | + void *rxbuf; | ||
6268 | + int bytes_to_transfer; | ||
6269 | + int bytes_to_receive; | ||
6270 | + struct xqspips_inst_format *curr_inst; | ||
6271 | + u8 inst_response; | ||
6272 | + unsigned int is_inst; | ||
6273 | + unsigned int is_dual; | ||
6274 | +}; | ||
6275 | + | ||
6276 | +struct spi_device { | ||
6277 | + struct xqspips master; | ||
6278 | + u32 max_speed_hz; | ||
6279 | + u8 chip_select; | ||
6280 | + u8 mode; | ||
6281 | + u8 bits_per_word; | ||
6282 | +}; | ||
6283 | + | ||
6284 | +struct spi_transfer { | ||
6285 | + const void *tx_buf; | ||
6286 | + void *rx_buf; | ||
6287 | + unsigned len; | ||
6288 | + unsigned cs_change:1; | ||
6289 | + u8 bits_per_word; | ||
6290 | + u16 delay_usecs; | ||
6291 | + u32 speed_hz; | ||
6292 | +}; | ||
6293 | + | ||
6294 | +struct zynq_spi_slave { | ||
6295 | + struct spi_slave slave; | ||
6296 | + struct spi_device qspi; | ||
6297 | +}; | ||
6298 | +#define to_zynq_spi_slave(s) container_of(s, struct zynq_spi_slave, slave) | ||
6299 | + | ||
6300 | +/* | ||
6301 | + * struct xqspips_inst_format - Defines qspi flash instruction format | ||
6302 | + * @opcode: Operational code of instruction | ||
6303 | + * @inst_size: Size of the instruction including address bytes | ||
6304 | + * @offset: Register address where instruction has to be written | ||
6305 | + */ | ||
6306 | +struct xqspips_inst_format { | ||
6307 | + u8 opcode; | ||
6308 | + u8 inst_size; | ||
6309 | + u8 offset; | ||
6310 | +}; | ||
6311 | + | ||
6312 | +/* List of all the QSPI instructions and its format */ | ||
6313 | +static struct xqspips_inst_format flash_inst[] = { | ||
6314 | + { XQSPIPS_FLASH_OPCODE_WREN, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6315 | + { XQSPIPS_FLASH_OPCODE_WRDS, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6316 | + { XQSPIPS_FLASH_OPCODE_RDSR1, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6317 | + { XQSPIPS_FLASH_OPCODE_RDSR2, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6318 | + { XQSPIPS_FLASH_OPCODE_WRSR, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6319 | + { XQSPIPS_FLASH_OPCODE_PP, 4, XQSPIPS_TXD_00_00_OFFSET }, | ||
6320 | + { XQSPIPS_FLASH_OPCODE_SE, 4, XQSPIPS_TXD_00_00_OFFSET }, | ||
6321 | + { XQSPIPS_FLASH_OPCODE_BE_32K, 4, XQSPIPS_TXD_00_00_OFFSET }, | ||
6322 | + { XQSPIPS_FLASH_OPCODE_BE_4K, 4, XQSPIPS_TXD_00_00_OFFSET }, | ||
6323 | + { XQSPIPS_FLASH_OPCODE_BE, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6324 | + { XQSPIPS_FLASH_OPCODE_ERASE_SUS, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6325 | + { XQSPIPS_FLASH_OPCODE_ERASE_RES, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6326 | + { XQSPIPS_FLASH_OPCODE_RDID, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6327 | + { XQSPIPS_FLASH_OPCODE_NORM_READ, 4, XQSPIPS_TXD_00_00_OFFSET }, | ||
6328 | + { XQSPIPS_FLASH_OPCODE_FAST_READ, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6329 | + { XQSPIPS_FLASH_OPCODE_DUAL_READ, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6330 | + { XQSPIPS_FLASH_OPCODE_QUAD_READ, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6331 | + { XQSPIPS_FLASH_OPCODE_BRWR, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6332 | + { XQSPIPS_FLASH_OPCODE_BRRD, 1, XQSPIPS_TXD_00_01_OFFSET }, | ||
6333 | + /* Add all the instructions supported by the flash device */ | ||
6334 | +}; | ||
6335 | + | ||
6336 | +/* | ||
6337 | + * xqspips_init_hw - Initialize the hardware | ||
6338 | + * @is_dual: Indicates whether dual memories are used | ||
6339 | + * @cs: Indicates which chip select is used in dual stacked | ||
6340 | + * | ||
6341 | + * The default settings of the QSPI controller's configurable parameters on | ||
6342 | + * reset are | ||
6343 | + * - Master mode | ||
6344 | + * - Baud rate divisor is set to 2 | ||
6345 | + * - Threshold value for TX FIFO not full interrupt is set to 1 | ||
6346 | + * - Flash memory interface mode enabled | ||
6347 | + * - Size of the word to be transferred as 8 bit | ||
6348 | + * This function performs the following actions | ||
6349 | + * - Disable and clear all the interrupts | ||
6350 | + * - Enable manual slave select | ||
6351 | + * - Enable manual start | ||
6352 | + * - Deselect all the chip select lines | ||
6353 | + * - Set the size of the word to be transferred as 32 bit | ||
6354 | + * - Set the little endian mode of TX FIFO and | ||
6355 | + * - Enable the QSPI controller | ||
6356 | + */ | ||
6357 | +static void xqspips_init_hw(int is_dual, unsigned int cs) | ||
6358 | +{ | ||
6359 | + u32 config_reg; | ||
6360 | + | ||
6361 | + writel(~XQSPIPS_ENABLE_ENABLE_MASK, &xqspips_base->enbr); | ||
6362 | + writel(0x7F, &xqspips_base->idisr); | ||
6363 | + | ||
6364 | + /* Disable linear mode as the boot loader may have used it */ | ||
6365 | + writel(0x0, &xqspips_base->lcr); | ||
6366 | + | ||
6367 | + /* Clear the RX FIFO */ | ||
6368 | + while (readl(&xqspips_base->isr) & XQSPIPS_IXR_RXNEMTY_MASK) | ||
6369 | + readl(&xqspips_base->drxr); | ||
6370 | + | ||
6371 | + writel(0x7F, &xqspips_base->isr); | ||
6372 | + config_reg = readl(&xqspips_base->confr); | ||
6373 | + config_reg &= 0xFBFFFFFF; /* Set little endian mode of TX FIFO */ | ||
6374 | + config_reg |= 0x8000FCC1; | ||
6375 | + writel(config_reg, &xqspips_base->confr); | ||
6376 | + | ||
6377 | + if (is_dual == MODE_DUAL_PARALLEL) | ||
6378 | + /* Enable two memories on seperate buses */ | ||
6379 | + writel((XQSPIPS_LCFG_TWO_MEM_MASK | | ||
6380 | + XQSPIPS_LCFG_SEP_BUS_MASK | | ||
6381 | + (1 << XQSPIPS_LCFG_DUMMY_SHIFT) | | ||
6382 | + XQSPIPS_FAST_READ_QOUT_CODE), | ||
6383 | + &xqspips_base->lcr); | ||
6384 | + else if (is_dual == MODE_DUAL_STACKED) { | ||
6385 | + if (cs) | ||
6386 | + /* Enable two memories on shared buse with upper mem */ | ||
6387 | + writel((XQSPIPS_LCFG_TWO_MEM_MASK | | ||
6388 | + XQSPIPS_LCFG_U_PAGE | | ||
6389 | + (1 << XQSPIPS_LCFG_DUMMY_SHIFT) | | ||
6390 | + XQSPIPS_FAST_READ_QOUT_CODE), | ||
6391 | + &xqspips_base->lcr); | ||
6392 | + else | ||
6393 | + /* Enable two memories on shared buse with lower mem */ | ||
6394 | + writel((XQSPIPS_LCFG_TWO_MEM_MASK | | ||
6395 | + (1 << XQSPIPS_LCFG_DUMMY_SHIFT) | | ||
6396 | + XQSPIPS_FAST_READ_QOUT_CODE), | ||
6397 | + &xqspips_base->lcr); | ||
6398 | + } | ||
6399 | + | ||
6400 | + writel(XQSPIPS_ENABLE_ENABLE_MASK, &xqspips_base->enbr); | ||
6401 | +} | ||
6402 | + | ||
6403 | +/* | ||
6404 | + * xqspips_copy_read_data - Copy data to RX buffer | ||
6405 | + * @xqspi: Pointer to the xqspips structure | ||
6406 | + * @data: The 32 bit variable where data is stored | ||
6407 | + * @size: Number of bytes to be copied from data to RX buffer | ||
6408 | + */ | ||
6409 | +static void xqspips_copy_read_data(struct xqspips *xqspi, u32 data, u8 size) | ||
6410 | +{ | ||
6411 | + u8 byte3; | ||
6412 | + | ||
6413 | + debug("xqspips_copy_read_data: data 0x%04x rxbuf addr: 0x%08x" | ||
6414 | + " size %d\n", data, (unsigned)(xqspi->rxbuf), size); | ||
6415 | + | ||
6416 | + if (xqspi->rxbuf) { | ||
6417 | + switch (size) { | ||
6418 | + case 1: | ||
6419 | + *((u8 *)xqspi->rxbuf) = data; | ||
6420 | + xqspi->rxbuf += 1; | ||
6421 | + break; | ||
6422 | + case 2: | ||
6423 | + *((u16 *)xqspi->rxbuf) = data; | ||
6424 | + xqspi->rxbuf += 2; | ||
6425 | + break; | ||
6426 | + case 3: | ||
6427 | + *((u16 *)xqspi->rxbuf) = data; | ||
6428 | + xqspi->rxbuf += 2; | ||
6429 | + byte3 = (u8)(data >> 16); | ||
6430 | + *((u8 *)xqspi->rxbuf) = byte3; | ||
6431 | + xqspi->rxbuf += 1; | ||
6432 | + break; | ||
6433 | + case 4: | ||
6434 | + /* Can not assume word aligned buffer */ | ||
6435 | + memcpy(xqspi->rxbuf, &data, size); | ||
6436 | + xqspi->rxbuf += 4; | ||
6437 | + break; | ||
6438 | + default: | ||
6439 | + /* This will never execute */ | ||
6440 | + break; | ||
6441 | + } | ||
6442 | + } | ||
6443 | + xqspi->bytes_to_receive -= size; | ||
6444 | + if (xqspi->bytes_to_receive < 0) | ||
6445 | + xqspi->bytes_to_receive = 0; | ||
6446 | +} | ||
6447 | + | ||
6448 | +/* | ||
6449 | + * xqspips_copy_write_data - Copy data from TX buffer | ||
6450 | + * @xqspi: Pointer to the xqspips structure | ||
6451 | + * @data: Pointer to the 32 bit variable where data is to be copied | ||
6452 | + * @size: Number of bytes to be copied from TX buffer to data | ||
6453 | + */ | ||
6454 | +static void xqspips_copy_write_data(struct xqspips *xqspi, u32 *data, u8 size) | ||
6455 | +{ | ||
6456 | + | ||
6457 | + if (xqspi->txbuf) { | ||
6458 | + switch (size) { | ||
6459 | + case 1: | ||
6460 | + *data = *((u8 *)xqspi->txbuf); | ||
6461 | + xqspi->txbuf += 1; | ||
6462 | + *data |= 0xFFFFFF00; | ||
6463 | + break; | ||
6464 | + case 2: | ||
6465 | + *data = *((u16 *)xqspi->txbuf); | ||
6466 | + xqspi->txbuf += 2; | ||
6467 | + *data |= 0xFFFF0000; | ||
6468 | + break; | ||
6469 | + case 3: | ||
6470 | + *data = *((u16 *)xqspi->txbuf); | ||
6471 | + xqspi->txbuf += 2; | ||
6472 | + *data |= (*((u8 *)xqspi->txbuf) << 16); | ||
6473 | + xqspi->txbuf += 1; | ||
6474 | + *data |= 0xFF000000; | ||
6475 | + break; | ||
6476 | + case 4: | ||
6477 | + /* Can not assume word aligned buffer */ | ||
6478 | + memcpy(data, xqspi->txbuf, size); | ||
6479 | + xqspi->txbuf += 4; | ||
6480 | + break; | ||
6481 | + default: | ||
6482 | + /* This will never execute */ | ||
6483 | + break; | ||
6484 | + } | ||
6485 | + } else | ||
6486 | + *data = 0; | ||
6487 | + | ||
6488 | + debug("xqspips_copy_write_data: data 0x%08x txbuf addr: 0x%08x" | ||
6489 | + " size %d\n", *data, (u32)xqspi->txbuf, size); | ||
6490 | + | ||
6491 | + xqspi->bytes_to_transfer -= size; | ||
6492 | + if (xqspi->bytes_to_transfer < 0) | ||
6493 | + xqspi->bytes_to_transfer = 0; | ||
6494 | +} | ||
6495 | + | ||
6496 | +/* | ||
6497 | + * xqspips_chipselect - Select or deselect the chip select line | ||
6498 | + * @qspi: Pointer to the spi_device structure | ||
6499 | + * @is_on: Select(1) or deselect (0) the chip select line | ||
6500 | + */ | ||
6501 | +static void xqspips_chipselect(struct spi_device *qspi, int is_on) | ||
6502 | +{ | ||
6503 | + u32 config_reg; | ||
6504 | + | ||
6505 | + debug("xqspips_chipselect: is_on: %d\n", is_on); | ||
6506 | + | ||
6507 | + config_reg = readl(&xqspips_base->confr); | ||
6508 | + | ||
6509 | + if (is_on) { | ||
6510 | + /* Select the slave */ | ||
6511 | + config_reg &= ~XQSPIPS_CONFIG_SSCTRL_MASK; | ||
6512 | + config_reg |= (((~(0x0001 << qspi->chip_select)) << 10) & | ||
6513 | + XQSPIPS_CONFIG_SSCTRL_MASK); | ||
6514 | + } else | ||
6515 | + /* Deselect the slave */ | ||
6516 | + config_reg |= XQSPIPS_CONFIG_SSCTRL_MASK; | ||
6517 | + | ||
6518 | + writel(config_reg, &xqspips_base->confr); | ||
6519 | +} | ||
6520 | + | ||
6521 | +/* | ||
6522 | + * xqspips_setup_transfer - Configure QSPI controller for specified transfer | ||
6523 | + * @qspi: Pointer to the spi_device structure | ||
6524 | + * @transfer: Pointer to the spi_transfer structure which provides information | ||
6525 | + * about next transfer setup parameters | ||
6526 | + * | ||
6527 | + * Sets the operational mode of QSPI controller for the next QSPI transfer and | ||
6528 | + * sets the requested clock frequency. | ||
6529 | + * | ||
6530 | + * returns: 0 on success and -1 on invalid input parameter | ||
6531 | + * | ||
6532 | + * Note: If the requested frequency is not an exact match with what can be | ||
6533 | + * obtained using the prescalar value, the driver sets the clock frequency which | ||
6534 | + * is lower than the requested frequency (maximum lower) for the transfer. If | ||
6535 | + * the requested frequency is higher or lower than that is supported by the QSPI | ||
6536 | + * controller the driver will set the highest or lowest frequency supported by | ||
6537 | + * controller. | ||
6538 | + */ | ||
6539 | +static int xqspips_setup_transfer(struct spi_device *qspi, | ||
6540 | + struct spi_transfer *transfer) | ||
6541 | +{ | ||
6542 | + struct xqspips *xqspi = &qspi->master; | ||
6543 | + u8 bits_per_word; | ||
6544 | + u32 config_reg; | ||
6545 | + u32 req_hz; | ||
6546 | + u32 baud_rate_val = 0; | ||
6547 | + | ||
6548 | + debug("xqspips_setup_transfer: qspi: 0x%08x transfer: 0x%08x\n", | ||
6549 | + (u32)qspi, (u32)transfer); | ||
6550 | + | ||
6551 | + bits_per_word = (transfer) ? | ||
6552 | + transfer->bits_per_word : qspi->bits_per_word; | ||
6553 | + req_hz = (transfer) ? transfer->speed_hz : qspi->max_speed_hz; | ||
6554 | + | ||
6555 | + if (qspi->mode & ~MODEBITS) { | ||
6556 | + printf("%s, unsupported mode bits %x\n", | ||
6557 | + __func__, qspi->mode & ~MODEBITS); | ||
6558 | + return -1; | ||
6559 | + } | ||
6560 | + | ||
6561 | + if (bits_per_word != 32) | ||
6562 | + bits_per_word = 32; | ||
6563 | + | ||
6564 | + config_reg = readl(&xqspips_base->confr); | ||
6565 | + | ||
6566 | + /* Set the QSPI clock phase and clock polarity */ | ||
6567 | + config_reg &= (~XQSPIPS_CONFIG_CPHA_MASK) & | ||
6568 | + (~XQSPIPS_CONFIG_CPOL_MASK); | ||
6569 | + if (qspi->mode & SPI_CPHA) | ||
6570 | + config_reg |= XQSPIPS_CONFIG_CPHA_MASK; | ||
6571 | + if (qspi->mode & SPI_CPOL) | ||
6572 | + config_reg |= XQSPIPS_CONFIG_CPOL_MASK; | ||
6573 | + | ||
6574 | + /* Set the clock frequency */ | ||
6575 | + if (xqspi->speed_hz != req_hz) { | ||
6576 | + baud_rate_val = 0; | ||
6577 | + while ((baud_rate_val < 8) && | ||
6578 | + (xqspi->input_clk_hz / (2 << baud_rate_val)) > req_hz) { | ||
6579 | + baud_rate_val++; | ||
6580 | + } | ||
6581 | + config_reg &= 0xFFFFFFC7; | ||
6582 | + config_reg |= (baud_rate_val << 3); | ||
6583 | + xqspi->speed_hz = req_hz; | ||
6584 | + } | ||
6585 | + | ||
6586 | + writel(config_reg, &xqspips_base->confr); | ||
6587 | + | ||
6588 | + debug("xqspips_setup_transfer: mode %d, %u bits/w, %u clock speed\n", | ||
6589 | + qspi->mode & MODEBITS, qspi->bits_per_word, xqspi->speed_hz); | ||
6590 | + | ||
6591 | + return 0; | ||
6592 | +} | ||
6593 | + | ||
6594 | +/* | ||
6595 | + * xqspips_fill_tx_fifo - Fills the TX FIFO with as many bytes as possible | ||
6596 | + * @xqspi: Pointer to the xqspips structure | ||
6597 | + */ | ||
6598 | +static void xqspips_fill_tx_fifo(struct xqspips *xqspi) | ||
6599 | +{ | ||
6600 | + u32 data = 0; | ||
6601 | + unsigned len, offset; | ||
6602 | + static const unsigned offsets[4] = { | ||
6603 | + XQSPIPS_TXD_00_00_OFFSET, XQSPIPS_TXD_00_01_OFFSET, | ||
6604 | + XQSPIPS_TXD_00_10_OFFSET, XQSPIPS_TXD_00_11_OFFSET }; | ||
6605 | + | ||
6606 | + while ((!(readl(&xqspips_base->isr) & | ||
6607 | + XQSPIPS_IXR_TXFULL_MASK)) && | ||
6608 | + (xqspi->bytes_to_transfer > 0)) { | ||
6609 | + if (xqspi->bytes_to_transfer < 4) { | ||
6610 | + /* Write TXD1, TXD2, TXD3 only if TxFIFO is empty. */ | ||
6611 | + if (!(readl(&xqspips_base->isr) | ||
6612 | + & XQSPIPS_IXR_TXNFULL_MASK) && | ||
6613 | + !xqspi->rxbuf) | ||
6614 | + return; | ||
6615 | + len = xqspi->bytes_to_transfer; | ||
6616 | + xqspips_copy_write_data(xqspi, &data, len); | ||
6617 | + offset = (xqspi->rxbuf) ? offsets[0] : offsets[len]; | ||
6618 | + writel(data, &xqspips_base->confr + (offset / 4)); | ||
6619 | + } else { | ||
6620 | + xqspips_copy_write_data(xqspi, &data, 4); | ||
6621 | + writel(data, &xqspips_base->txd0r); | ||
6622 | + } | ||
6623 | + } | ||
6624 | +} | ||
6625 | + | ||
6626 | +/* | ||
6627 | + * xqspips_irq_poll - Interrupt service routine of the QSPI controller | ||
6628 | + * @xqspi: Pointer to the xqspips structure | ||
6629 | + * | ||
6630 | + * This function handles TX empty and Mode Fault interrupts only. | ||
6631 | + * On TX empty interrupt this function reads the received data from RX FIFO and | ||
6632 | + * fills the TX FIFO if there is any data remaining to be transferred. | ||
6633 | + * On Mode Fault interrupt this function indicates that transfer is completed, | ||
6634 | + * the SPI subsystem will identify the error as the remaining bytes to be | ||
6635 | + * transferred is non-zero. | ||
6636 | + * | ||
6637 | + * returns: 0 for poll timeout | ||
6638 | + * 1 transfer operation complete | ||
6639 | + */ | ||
6640 | +static int xqspips_irq_poll(struct xqspips *xqspi) | ||
6641 | +{ | ||
6642 | + int max_loop; | ||
6643 | + u32 intr_status; | ||
6644 | + | ||
6645 | + debug("xqspips_irq_poll: xqspi: 0x%08x\n", (u32)xqspi); | ||
6646 | + | ||
6647 | + /* Poll until any of the interrupt status bits are set */ | ||
6648 | + max_loop = 0; | ||
6649 | + do { | ||
6650 | + intr_status = readl(&xqspips_base->isr); | ||
6651 | + max_loop++; | ||
6652 | + } while ((intr_status == 0) && (max_loop < 100000)); | ||
6653 | + | ||
6654 | + if (intr_status == 0) { | ||
6655 | + printf("xqspips_irq_poll: timeout\n"); | ||
6656 | + return 0; | ||
6657 | + } | ||
6658 | + | ||
6659 | + writel(intr_status, &xqspips_base->isr); | ||
6660 | + | ||
6661 | + /* Disable all interrupts */ | ||
6662 | + writel(XQSPIPS_IXR_ALL_MASK, &xqspips_base->idisr); | ||
6663 | + if ((intr_status & XQSPIPS_IXR_TXNFULL_MASK) || | ||
6664 | + (intr_status & XQSPIPS_IXR_RXNEMTY_MASK)) { | ||
6665 | + | ||
6666 | + /* | ||
6667 | + * This bit is set when Tx FIFO has < THRESHOLD entries. We have | ||
6668 | + * the THRESHOLD value set to 1, so this bit indicates Tx FIFO | ||
6669 | + * is empty | ||
6670 | + */ | ||
6671 | + u32 config_reg; | ||
6672 | + | ||
6673 | + /* Read out the data from the RX FIFO */ | ||
6674 | + while (readl(&xqspips_base->isr) & | ||
6675 | + XQSPIPS_IXR_RXNEMTY_MASK) { | ||
6676 | + u32 data; | ||
6677 | + | ||
6678 | + data = readl(&xqspips_base->drxr); | ||
6679 | + | ||
6680 | + if ((xqspi->inst_response) && | ||
6681 | + (!((xqspi->curr_inst->opcode == | ||
6682 | + XQSPIPS_FLASH_OPCODE_RDSR1) || | ||
6683 | + (xqspi->curr_inst->opcode == | ||
6684 | + XQSPIPS_FLASH_OPCODE_RDSR2)))) { | ||
6685 | + xqspi->inst_response = 0; | ||
6686 | + xqspips_copy_read_data(xqspi, data, | ||
6687 | + xqspi->curr_inst->inst_size); | ||
6688 | + } else if (xqspi->bytes_to_receive < 4) | ||
6689 | + xqspips_copy_read_data(xqspi, data, | ||
6690 | + xqspi->bytes_to_receive); | ||
6691 | + else | ||
6692 | + xqspips_copy_read_data(xqspi, data, 4); | ||
6693 | + } | ||
6694 | + | ||
6695 | + if (xqspi->bytes_to_transfer) { | ||
6696 | + /* There is more data to send */ | ||
6697 | + xqspips_fill_tx_fifo(xqspi); | ||
6698 | + | ||
6699 | + writel(XQSPIPS_IXR_ALL_MASK, &xqspips_base->ier); | ||
6700 | + | ||
6701 | + config_reg = readl(&xqspips_base->confr); | ||
6702 | + | ||
6703 | + config_reg |= XQSPIPS_CONFIG_MANSRT_MASK; | ||
6704 | + writel(config_reg, &xqspips_base->confr); | ||
6705 | + } else { | ||
6706 | + /* | ||
6707 | + * If transfer and receive is completed then only send | ||
6708 | + * complete signal | ||
6709 | + */ | ||
6710 | + if (!xqspi->bytes_to_receive) { | ||
6711 | + /* return operation complete */ | ||
6712 | + writel(XQSPIPS_IXR_ALL_MASK, | ||
6713 | + &xqspips_base->idisr); | ||
6714 | + return 1; | ||
6715 | + } | ||
6716 | + } | ||
6717 | + } | ||
6718 | + | ||
6719 | + return 0; | ||
6720 | +} | ||
6721 | + | ||
6722 | +/* | ||
6723 | + * xqspips_start_transfer - Initiates the QSPI transfer | ||
6724 | + * @qspi: Pointer to the spi_device structure | ||
6725 | + * @transfer: Pointer to the spi_transfer structure which provide information | ||
6726 | + * about next transfer parameters | ||
6727 | + * | ||
6728 | + * This function fills the TX FIFO, starts the QSPI transfer, and waits for the | ||
6729 | + * transfer to be completed. | ||
6730 | + * | ||
6731 | + * returns: Number of bytes transferred in the last transfer | ||
6732 | + */ | ||
6733 | +static int xqspips_start_transfer(struct spi_device *qspi, | ||
6734 | + struct spi_transfer *transfer) | ||
6735 | +{ | ||
6736 | + struct xqspips *xqspi = &qspi->master; | ||
6737 | + u32 config_reg; | ||
6738 | + u32 data = 0; | ||
6739 | + u8 instruction = 0; | ||
6740 | + u8 index; | ||
6741 | + | ||
6742 | + debug("xqspips_start_transfer: qspi: 0x%08x transfer: 0x%08x len: %d\n", | ||
6743 | + (u32)qspi, (u32)transfer, transfer->len); | ||
6744 | + | ||
6745 | + xqspi->txbuf = transfer->tx_buf; | ||
6746 | + xqspi->rxbuf = transfer->rx_buf; | ||
6747 | + xqspi->bytes_to_transfer = transfer->len; | ||
6748 | + xqspi->bytes_to_receive = transfer->len; | ||
6749 | + | ||
6750 | + if (xqspi->txbuf) | ||
6751 | + instruction = *(u8 *)xqspi->txbuf; | ||
6752 | + | ||
6753 | + if (instruction && xqspi->is_inst) { | ||
6754 | + for (index = 0 ; index < ARRAY_SIZE(flash_inst); index++) | ||
6755 | + if (instruction == flash_inst[index].opcode) | ||
6756 | + break; | ||
6757 | + | ||
6758 | + /* | ||
6759 | + * Instruction might have already been transmitted. This is a | ||
6760 | + * 'data only' transfer | ||
6761 | + */ | ||
6762 | + if (index == ARRAY_SIZE(flash_inst)) | ||
6763 | + goto xfer_data; | ||
6764 | + | ||
6765 | + xqspi->curr_inst = &flash_inst[index]; | ||
6766 | + xqspi->inst_response = 1; | ||
6767 | + | ||
6768 | + /* | ||
6769 | + * In case of dual memories, convert 25 bit address to 24 bit | ||
6770 | + * address before transmitting to the 2 memories | ||
6771 | + */ | ||
6772 | + if ((xqspi->is_dual == MODE_DUAL_PARALLEL) && | ||
6773 | + ((instruction == XQSPIPS_FLASH_OPCODE_PP) || | ||
6774 | + (instruction == XQSPIPS_FLASH_OPCODE_SE) || | ||
6775 | + (instruction == XQSPIPS_FLASH_OPCODE_BE_32K) || | ||
6776 | + (instruction == XQSPIPS_FLASH_OPCODE_BE_4K) || | ||
6777 | + (instruction == XQSPIPS_FLASH_OPCODE_BE) || | ||
6778 | + (instruction == XQSPIPS_FLASH_OPCODE_NORM_READ) || | ||
6779 | + (instruction == XQSPIPS_FLASH_OPCODE_FAST_READ) || | ||
6780 | + (instruction == XQSPIPS_FLASH_OPCODE_DUAL_READ) || | ||
6781 | + (instruction == XQSPIPS_FLASH_OPCODE_QUAD_READ))) { | ||
6782 | + | ||
6783 | + u8 *ptr = (u8 *) (xqspi->txbuf); | ||
6784 | + data = ((u32) ptr[1] << 24) | ((u32) ptr[2] << 16) | | ||
6785 | + ((u32) ptr[3] << 8) | ((u32) ptr[4]); | ||
6786 | + data = data/2; | ||
6787 | + ptr[1] = (u8) (data >> 16); | ||
6788 | + ptr[2] = (u8) (data >> 8); | ||
6789 | + ptr[3] = (u8) (data); | ||
6790 | + xqspi->bytes_to_transfer -= 1; | ||
6791 | + xqspi->bytes_to_receive -= 1; | ||
6792 | + } | ||
6793 | + | ||
6794 | + /* Get the instruction */ | ||
6795 | + data = 0; | ||
6796 | + xqspips_copy_write_data(xqspi, &data, | ||
6797 | + xqspi->curr_inst->inst_size); | ||
6798 | + | ||
6799 | + /* | ||
6800 | + * Write the instruction to LSB of the FIFO. The core is | ||
6801 | + * designed such that it is not necessary to check whether the | ||
6802 | + * write FIFO is full before writing. However, write would be | ||
6803 | + * delayed if the user tries to write when write FIFO is full | ||
6804 | + */ | ||
6805 | + writel(data, &xqspips_base->confr + | ||
6806 | + (xqspi->curr_inst->offset / 4)); | ||
6807 | + | ||
6808 | + /* | ||
6809 | + * Read status register and Read ID instructions don't require | ||
6810 | + * to ignore the extra bytes in response of instruction as | ||
6811 | + * response contains the value | ||
6812 | + */ | ||
6813 | + if ((instruction == XQSPIPS_FLASH_OPCODE_RDSR1) || | ||
6814 | + (instruction == XQSPIPS_FLASH_OPCODE_RDSR2) || | ||
6815 | + (instruction == XQSPIPS_FLASH_OPCODE_RDID) || | ||
6816 | + (instruction == XQSPIPS_FLASH_OPCODE_BRRD)) { | ||
6817 | + if (xqspi->bytes_to_transfer < 4) | ||
6818 | + xqspi->bytes_to_transfer = 0; | ||
6819 | + else | ||
6820 | + xqspi->bytes_to_transfer -= 3; | ||
6821 | + } | ||
6822 | + } | ||
6823 | + | ||
6824 | +xfer_data: | ||
6825 | + /* | ||
6826 | + * In case of Fast, Dual and Quad reads, transmit the instruction first. | ||
6827 | + * Address and dummy byte should be transmitted after instruction | ||
6828 | + * is transmitted | ||
6829 | + */ | ||
6830 | + if (((xqspi->is_inst == 0) && (xqspi->bytes_to_transfer)) || | ||
6831 | + ((xqspi->bytes_to_transfer) && | ||
6832 | + (instruction != XQSPIPS_FLASH_OPCODE_FAST_READ) && | ||
6833 | + (instruction != XQSPIPS_FLASH_OPCODE_DUAL_READ) && | ||
6834 | + (instruction != XQSPIPS_FLASH_OPCODE_QUAD_READ))) | ||
6835 | + xqspips_fill_tx_fifo(xqspi); | ||
6836 | + | ||
6837 | + writel(XQSPIPS_IXR_ALL_MASK, &xqspips_base->ier); | ||
6838 | + /* Start the transfer by enabling manual start bit */ | ||
6839 | + config_reg = readl(&xqspips_base->confr) | XQSPIPS_CONFIG_MANSRT_MASK; | ||
6840 | + writel(config_reg, &xqspips_base->confr); | ||
6841 | + | ||
6842 | + /* wait for completion */ | ||
6843 | + do { | ||
6844 | + data = xqspips_irq_poll(xqspi); | ||
6845 | + } while (data == 0); | ||
6846 | + | ||
6847 | + return (transfer->len) - (xqspi->bytes_to_transfer); | ||
6848 | +} | ||
6849 | + | ||
6850 | +static int xqspips_transfer(struct spi_device *qspi, | ||
6851 | + struct spi_transfer *transfer) | ||
6852 | +{ | ||
6853 | + struct xqspips *xqspi = &qspi->master; | ||
6854 | + unsigned cs_change = 1; | ||
6855 | + int status = 0; | ||
6856 | + | ||
6857 | + debug("xqspips_transfer\n"); | ||
6858 | + | ||
6859 | + while (1) { | ||
6860 | + if (transfer->bits_per_word || transfer->speed_hz) { | ||
6861 | + status = xqspips_setup_transfer(qspi, transfer); | ||
6862 | + if (status < 0) | ||
6863 | + break; | ||
6864 | + } | ||
6865 | + | ||
6866 | + /* Select the chip if required */ | ||
6867 | + if (cs_change) | ||
6868 | + xqspips_chipselect(qspi, 1); | ||
6869 | + | ||
6870 | + cs_change = transfer->cs_change; | ||
6871 | + | ||
6872 | + if (!transfer->tx_buf && !transfer->rx_buf && transfer->len) { | ||
6873 | + status = -1; | ||
6874 | + break; | ||
6875 | + } | ||
6876 | + | ||
6877 | + /* Request the transfer */ | ||
6878 | + if (transfer->len) { | ||
6879 | + status = xqspips_start_transfer(qspi, transfer); | ||
6880 | + xqspi->is_inst = 0; | ||
6881 | + } | ||
6882 | + | ||
6883 | + if (status != transfer->len) { | ||
6884 | + if (status > 0) | ||
6885 | + status = -EMSGSIZE; | ||
6886 | + break; | ||
6887 | + } | ||
6888 | + status = 0; | ||
6889 | + | ||
6890 | + if (transfer->delay_usecs) | ||
6891 | + udelay(transfer->delay_usecs); | ||
6892 | + | ||
6893 | + if (cs_change) | ||
6894 | + /* Deselect the chip */ | ||
6895 | + xqspips_chipselect(qspi, 0); | ||
6896 | + | ||
6897 | + break; | ||
6898 | + } | ||
6899 | + | ||
6900 | + xqspips_setup_transfer(qspi, NULL); | ||
6901 | + | ||
6902 | + return 0; | ||
6903 | +} | ||
6904 | + | ||
6905 | +/* | ||
6906 | + * xqspips_check_is_dual_flash - checking for dual or single qspi | ||
6907 | + * | ||
6908 | + * This function will check the type of the flash whether it supports | ||
6909 | + * single or dual qspi based on the MIO configuration done by FSBL. | ||
6910 | + * | ||
6911 | + * User needs to correctly configure the MIO's based on the | ||
6912 | + * number of qspi flashes present on the board. | ||
6913 | + * | ||
6914 | + * function will return -1, if there is no MIO configuration for | ||
6915 | + * qspi flash. | ||
6916 | + */ | ||
6917 | +static int xqspips_check_is_dual_flash(void) | ||
6918 | +{ | ||
6919 | + int is_dual = MODE_UNKNOWN; | ||
6920 | + int lower_mio = 0, upper_mio = 0, upper_mio_cs1 = 0; | ||
6921 | + | ||
6922 | + lower_mio = zynq_slcr_get_mio_pin_status("qspi0"); | ||
6923 | + if (lower_mio == XQSPIPS_MIO_NUM_QSPI0) | ||
6924 | + is_dual = MODE_SINGLE; | ||
6925 | + | ||
6926 | + upper_mio_cs1 = zynq_slcr_get_mio_pin_status("qspi1_cs"); | ||
6927 | + if ((lower_mio == XQSPIPS_MIO_NUM_QSPI0) && | ||
6928 | + (upper_mio_cs1 == XQSPIPS_MIO_NUM_QSPI1_CS)) | ||
6929 | + is_dual = MODE_DUAL_STACKED; | ||
6930 | + | ||
6931 | + upper_mio = zynq_slcr_get_mio_pin_status("qspi1"); | ||
6932 | + if ((lower_mio == XQSPIPS_MIO_NUM_QSPI0) && | ||
6933 | + (upper_mio_cs1 == XQSPIPS_MIO_NUM_QSPI1_CS) && | ||
6934 | + (upper_mio == XQSPIPS_MIO_NUM_QSPI1)) | ||
6935 | + is_dual = MODE_DUAL_PARALLEL; | ||
6936 | + | ||
6937 | + return is_dual; | ||
6938 | +} | ||
6939 | + | ||
6940 | +/* | ||
6941 | + * xqspips_write_quad_bit - Write 1 to QUAD bit on flash | ||
6942 | + * | ||
6943 | + * This function will write a 1 to quad bit in flash | ||
6944 | + * using QSPI controller and supports only spansion flash. | ||
6945 | + * | ||
6946 | + * @regs_base: base address of QSPI controller | ||
6947 | + */ | ||
6948 | +static void xqspips_write_quad_bit(void __iomem *regs_base) | ||
6949 | +{ | ||
6950 | + u32 config_reg, intr_status; | ||
6951 | + | ||
6952 | + /* enable the QSPI controller */ | ||
6953 | + writel(XQSPIPS_ENABLE_ENABLE_MASK, &xqspips_base->enbr); | ||
6954 | + | ||
6955 | + /* Write QUAD bit with 3-byte instruction */ | ||
6956 | + writel(0x20001, &xqspips_base->txd3r); | ||
6957 | + | ||
6958 | + /* Enable manual start command */ | ||
6959 | + config_reg = readl(&xqspips_base->confr) | XQSPIPS_CONFIG_MANSRT_MASK; | ||
6960 | + writel(config_reg, &xqspips_base->confr); | ||
6961 | + | ||
6962 | + /* Wait for the transfer to finish by polling Tx fifo status */ | ||
6963 | + do { | ||
6964 | + intr_status = readl(&xqspips_base->isr); | ||
6965 | + } while ((intr_status & 0x04) == 0); | ||
6966 | + | ||
6967 | + /* Read data receive register */ | ||
6968 | + config_reg = readl(&xqspips_base->drxr); | ||
6969 | +} | ||
6970 | + | ||
6971 | +int spi_cs_is_valid(unsigned int bus, unsigned int cs) | ||
6972 | +{ | ||
6973 | + /* 1 bus with 2 chipselect */ | ||
6974 | + return bus == 0 && cs < 2; | ||
6975 | +} | ||
6976 | + | ||
6977 | +void spi_cs_activate(struct spi_slave *slave) | ||
6978 | +{ | ||
6979 | + debug("spi_cs_activate: slave 0x%08x\n", (unsigned)slave); | ||
6980 | +} | ||
6981 | + | ||
6982 | +void spi_cs_deactivate(struct spi_slave *slave) | ||
6983 | +{ | ||
6984 | + debug("spi_cs_deactivate: slave 0x%08x\n", (unsigned)slave); | ||
6985 | +} | ||
6986 | + | ||
6987 | +void spi_init() | ||
6988 | +{ | ||
6989 | + debug("spi_init\n"); | ||
6990 | +} | ||
6991 | + | ||
6992 | +/* | ||
6993 | + * spi_enable_quad_bit - Enable the QUAD bit for SPI flash | ||
6994 | + * | ||
6995 | + * This function will enable the quad bit in flash using | ||
6996 | + * the QSPI controller. Supports only spansion. | ||
6997 | + * | ||
6998 | + * @spi : SPI slave structure | ||
6999 | + */ | ||
7000 | +void spi_enable_quad_bit(struct spi_slave *spi) | ||
7001 | +{ | ||
7002 | + int ret; | ||
7003 | + u8 idcode[5]; | ||
7004 | + u8 rdid_cmd = 0x9f; /* RDID */ | ||
7005 | + u8 rcr_data = 0; | ||
7006 | + u8 rcr_cmd = 0x35; /* RCR */ | ||
7007 | + u8 rdsr_cmd = 0x05; /* RDSR */ | ||
7008 | + u8 wren_cmd = 0x06; /* WREN */ | ||
7009 | + | ||
7010 | + ret = spi_flash_cmd(spi, rdid_cmd, &idcode, sizeof(idcode)); | ||
7011 | + if (ret) { | ||
7012 | + debug("SF error: Failed read RDID\n"); | ||
7013 | + return; | ||
7014 | + } | ||
7015 | + | ||
7016 | + if ((idcode[0] == 0x01) || (idcode[0] == 0xef)) { | ||
7017 | + /* Read config register */ | ||
7018 | + ret = spi_flash_cmd_read(spi, &rcr_cmd, sizeof(rcr_cmd), | ||
7019 | + &rcr_data, sizeof(rcr_data)); | ||
7020 | + if (ret) { | ||
7021 | + debug("SF error: Failed read RCR\n"); | ||
7022 | + return; | ||
7023 | + } | ||
7024 | + | ||
7025 | + if (rcr_data & 0x2) | ||
7026 | + debug("QUAD bit is already set..\n"); | ||
7027 | + else { | ||
7028 | + debug("QUAD bit needs to be set ..\n"); | ||
7029 | + | ||
7030 | + /* Write enable */ | ||
7031 | + ret = spi_flash_cmd(spi, wren_cmd, NULL, 0); | ||
7032 | + if (ret) { | ||
7033 | + debug("SF error: Failed write WREN\n"); | ||
7034 | + return; | ||
7035 | + } | ||
7036 | + | ||
7037 | + /* Write QUAD bit */ | ||
7038 | + xqspips_write_quad_bit((void *)XPSS_QSPI_BASEADDR); | ||
7039 | + | ||
7040 | + /* Read RDSR */ | ||
7041 | + do { | ||
7042 | + ret = spi_flash_cmd_read(spi, &rdsr_cmd, | ||
7043 | + sizeof(rdsr_cmd), &rcr_data, | ||
7044 | + sizeof(rcr_data)); | ||
7045 | + } while ((ret == 0) && (rcr_data != 0)); | ||
7046 | + | ||
7047 | + /* Read config register */ | ||
7048 | + ret = spi_flash_cmd_read(spi, &rcr_cmd, sizeof(rcr_cmd), | ||
7049 | + &rcr_data, sizeof(rcr_data)); | ||
7050 | + if (!(rcr_data & 0x2)) { | ||
7051 | + printf("SF error: Fail to set QUAD enable bit" | ||
7052 | + " 0x%x\n", rcr_data); | ||
7053 | + return; | ||
7054 | + } else | ||
7055 | + debug("SF: QUAD enable bit is set 0x%x\n", | ||
7056 | + rcr_data); | ||
7057 | + } | ||
7058 | + } else | ||
7059 | + debug("SF: QUAD bit not enabled for 0x%x SPI flash\n", | ||
7060 | + idcode[0]); | ||
7061 | + | ||
7062 | + return; | ||
7063 | +} | ||
7064 | + | ||
7065 | +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, | ||
7066 | + unsigned int max_hz, unsigned int mode) | ||
7067 | +{ | ||
7068 | + int is_dual; | ||
7069 | + struct zynq_spi_slave *pspi; | ||
7070 | + | ||
7071 | + debug("spi_setup_slave: bus: %d cs: %d max_hz: %d mode: %d\n", | ||
7072 | + bus, cs, max_hz, mode); | ||
7073 | + | ||
7074 | + if (!spi_cs_is_valid(bus, cs)) | ||
7075 | + return NULL; | ||
7076 | + | ||
7077 | + is_dual = xqspips_check_is_dual_flash(); | ||
7078 | + | ||
7079 | + if (is_dual == MODE_UNKNOWN) { | ||
7080 | + printf("SPI error: No QSPI device detected based" | ||
7081 | + " on MIO settings\n"); | ||
7082 | + return NULL; | ||
7083 | + } | ||
7084 | + | ||
7085 | + xqspips_init_hw(is_dual, cs); | ||
7086 | + | ||
7087 | + pspi = malloc(sizeof(struct zynq_spi_slave)); | ||
7088 | + if (!pspi) { | ||
7089 | + printf("SPI error: fail to allocate zynq_spi_slave\n"); | ||
7090 | + return NULL; | ||
7091 | + } | ||
7092 | + | ||
7093 | + pspi->slave.bus = bus; | ||
7094 | + pspi->slave.cs = cs; | ||
7095 | + pspi->slave.is_dual = is_dual; | ||
7096 | + pspi->qspi.master.input_clk_hz = 100000000; | ||
7097 | + pspi->qspi.master.speed_hz = pspi->qspi.master.input_clk_hz / 2; | ||
7098 | + pspi->qspi.max_speed_hz = pspi->qspi.master.speed_hz; | ||
7099 | + pspi->qspi.master.is_dual = is_dual; | ||
7100 | + pspi->qspi.mode = mode; | ||
7101 | + pspi->qspi.chip_select = 0; | ||
7102 | + pspi->qspi.bits_per_word = 32; | ||
7103 | + xqspips_setup_transfer(&pspi->qspi, NULL); | ||
7104 | + | ||
7105 | + spi_enable_quad_bit(&pspi->slave); | ||
7106 | + | ||
7107 | + return &pspi->slave; | ||
7108 | +} | ||
7109 | + | ||
7110 | +void spi_free_slave(struct spi_slave *slave) | ||
7111 | +{ | ||
7112 | + struct zynq_spi_slave *pspi; | ||
7113 | + | ||
7114 | + debug("spi_free_slave: slave: 0x%08x\n", (u32)slave); | ||
7115 | + | ||
7116 | + pspi = to_zynq_spi_slave(slave); | ||
7117 | + free(pspi); | ||
7118 | +} | ||
7119 | + | ||
7120 | +int spi_claim_bus(struct spi_slave *slave) | ||
7121 | +{ | ||
7122 | + debug("spi_claim_bus: slave: 0x%08x\n", (u32)slave); | ||
7123 | + return 0; | ||
7124 | +} | ||
7125 | + | ||
7126 | +void spi_release_bus(struct spi_slave *slave) | ||
7127 | +{ | ||
7128 | + debug("spi_release_bus: slave: 0x%08x\n", (u32)slave); | ||
7129 | +} | ||
7130 | + | ||
7131 | +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, | ||
7132 | + void *din, unsigned long flags) | ||
7133 | +{ | ||
7134 | + struct zynq_spi_slave *pspi; | ||
7135 | + struct spi_transfer transfer; | ||
7136 | + | ||
7137 | + debug("spi_xfer: slave: 0x%08x bitlen: %d dout: 0x%08x din:" | ||
7138 | + " 0x%08x flags: 0x%lx\n", | ||
7139 | + (u32)slave, bitlen, (u32)dout, (u32)din, flags); | ||
7140 | + | ||
7141 | + pspi = (struct zynq_spi_slave *)slave; | ||
7142 | + transfer.tx_buf = dout; | ||
7143 | + transfer.rx_buf = din; | ||
7144 | + transfer.len = bitlen / 8; | ||
7145 | + | ||
7146 | + /* | ||
7147 | + * Festering sore. | ||
7148 | + * Assume that the beginning of a transfer with bits to | ||
7149 | + * transmit must contain a device command. | ||
7150 | + */ | ||
7151 | + if (dout && flags & SPI_XFER_BEGIN) | ||
7152 | + pspi->qspi.master.is_inst = 1; | ||
7153 | + else | ||
7154 | + pspi->qspi.master.is_inst = 0; | ||
7155 | + | ||
7156 | + if (flags & SPI_XFER_END) | ||
7157 | + transfer.cs_change = 1; | ||
7158 | + else | ||
7159 | + transfer.cs_change = 0; | ||
7160 | + | ||
7161 | + transfer.delay_usecs = 0; | ||
7162 | + transfer.bits_per_word = 32; | ||
7163 | + transfer.speed_hz = pspi->qspi.max_speed_hz; | ||
7164 | + | ||
7165 | + xqspips_transfer(&pspi->qspi, &transfer); | ||
7166 | + | ||
7167 | + return 0; | ||
7168 | +} | ||
7169 | diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile | ||
7170 | index b1f4e0f..13e7c37 100644 | ||
7171 | --- a/drivers/watchdog/Makefile | ||
7172 | +++ b/drivers/watchdog/Makefile | ||
7173 | @@ -32,6 +32,7 @@ COBJS-y += imx_watchdog.o | ||
7174 | endif | ||
7175 | COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o | ||
7176 | COBJS-$(CONFIG_S5P) += s5p_wdt.o | ||
7177 | +COBJS-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o | ||
7178 | |||
7179 | COBJS := $(COBJS-y) | ||
7180 | SRCS := $(COBJS:.o=.c) | ||
7181 | diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c | ||
7182 | new file mode 100644 | ||
7183 | index 0000000..96caa07 | ||
7184 | --- /dev/null | ||
7185 | +++ b/drivers/watchdog/xilinx_tb_wdt.c | ||
7186 | @@ -0,0 +1,87 @@ | ||
7187 | +/* | ||
7188 | + * Copyright (c) 2011-2013 Xilinx Inc. | ||
7189 | + * | ||
7190 | + * See file CREDITS for list of people who contributed to this | ||
7191 | + * project. | ||
7192 | + * | ||
7193 | + * This program is free software; you can redistribute it and/or | ||
7194 | + * modify it under the terms of the GNU General Public License as | ||
7195 | + * published by the Free Software Foundation; either version 2 of | ||
7196 | + * the License, or (at your option) any later version. | ||
7197 | + * | ||
7198 | + * This program is distributed in the hope that it will be useful, | ||
7199 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
7200 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
7201 | + * GNU General Public License for more details. | ||
7202 | + * | ||
7203 | + * You should have received a copy of the GNU General Public License | ||
7204 | + * along with this program; if not, write to the Free Software | ||
7205 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
7206 | + * MA 02111-1307 USA | ||
7207 | + */ | ||
7208 | + | ||
7209 | +#include <common.h> | ||
7210 | +#include <asm/io.h> | ||
7211 | +#include <asm/microblaze_intc.h> | ||
7212 | +#include <asm/processor.h> | ||
7213 | +#include <watchdog.h> | ||
7214 | + | ||
7215 | +#define XWT_CSR0_WRS_MASK 0x00000008 /* Reset status Mask */ | ||
7216 | +#define XWT_CSR0_WDS_MASK 0x00000004 /* Timer state Mask */ | ||
7217 | +#define XWT_CSR0_EWDT1_MASK 0x00000002 /* Enable bit 1 Mask*/ | ||
7218 | +#define XWT_CSRX_EWDT2_MASK 0x00000001 /* Enable bit 2 Mask */ | ||
7219 | + | ||
7220 | +struct watchdog_regs { | ||
7221 | + u32 twcsr0; /* 0x0 */ | ||
7222 | + u32 twcsr1; /* 0x4 */ | ||
7223 | + u32 tbr; /* 0x8 */ | ||
7224 | +}; | ||
7225 | + | ||
7226 | +#define watchdog_base ((struct watchdog_regs *) CONFIG_WATCHDOG_BASEADDR) | ||
7227 | + | ||
7228 | +void hw_watchdog_reset(void) | ||
7229 | +{ | ||
7230 | + u32 reg; | ||
7231 | + | ||
7232 | + /* Read the current contents of TCSR0 */ | ||
7233 | + reg = readl(&watchdog_base->twcsr0); | ||
7234 | + | ||
7235 | + /* Clear the watchdog WDS bit */ | ||
7236 | + if (reg & (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK)) { | ||
7237 | + writel(reg | XWT_CSR0_WDS_MASK, &watchdog_base->twcsr0); | ||
7238 | + } | ||
7239 | +} | ||
7240 | + | ||
7241 | +void hw_watchdog_disable(void) | ||
7242 | +{ | ||
7243 | + u32 reg; | ||
7244 | + | ||
7245 | + /* Read the current contents of TCSR0 */ | ||
7246 | + reg = readl(&watchdog_base->twcsr0); | ||
7247 | + | ||
7248 | + writel(reg & ~XWT_CSR0_EWDT1_MASK, &watchdog_base->twcsr0); | ||
7249 | + writel(~XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1); | ||
7250 | + | ||
7251 | + puts("Watchdog disabled!\n"); | ||
7252 | +} | ||
7253 | + | ||
7254 | +static void hw_watchdog_isr(void *arg) | ||
7255 | +{ | ||
7256 | + hw_watchdog_reset(); | ||
7257 | +} | ||
7258 | + | ||
7259 | +int hw_watchdog_init(void) | ||
7260 | +{ | ||
7261 | + int ret; | ||
7262 | + | ||
7263 | + writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK), | ||
7264 | + &watchdog_base->twcsr0); | ||
7265 | + writel(XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1); | ||
7266 | + | ||
7267 | + ret = install_interrupt_handler(CONFIG_WATCHDOG_IRQ, | ||
7268 | + hw_watchdog_isr, NULL); | ||
7269 | + if (ret) | ||
7270 | + return 1; | ||
7271 | + | ||
7272 | + return 0; | ||
7273 | +} | ||
7274 | diff --git a/include/netdev.h b/include/netdev.h | ||
7275 | index 7f158d4..bef033c 100644 | ||
7276 | --- a/include/netdev.h | ||
7277 | +++ b/include/netdev.h | ||
7278 | @@ -102,8 +102,8 @@ int xilinx_axiemac_initialize(bd_t *bis, unsigned long base_addr, | ||
7279 | unsigned long dma_addr); | ||
7280 | int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, | ||
7281 | int txpp, int rxpp); | ||
7282 | -int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags, | ||
7283 | - unsigned long ctrl_addr); | ||
7284 | +int xilinx_ll_temac_initialize(bd_t *bis, unsigned long base_addr, | ||
7285 | + int mode, unsigned long ctrl); | ||
7286 | int zynq_gem_initialize(bd_t *bis, int base_addr); | ||
7287 | /* | ||
7288 | * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface | ||
7289 | diff --git a/include/spi.h b/include/spi.h | ||
7290 | index 60e85db..f483742 100644 | ||
7291 | --- a/include/spi.h | ||
7292 | +++ b/include/spi.h | ||
7293 | @@ -49,10 +49,12 @@ | ||
7294 | * | ||
7295 | * bus: ID of the bus that the slave is attached to. | ||
7296 | * cs: ID of the chip select connected to the slave. | ||
7297 | + * is_dual: Indicates whether dual memories are used | ||
7298 | */ | ||
7299 | struct spi_slave { | ||
7300 | unsigned int bus; | ||
7301 | unsigned int cs; | ||
7302 | + unsigned int is_dual; | ||
7303 | }; | ||
7304 | |||
7305 | /*----------------------------------------------------------------------- | ||
7306 | diff --git a/include/spi_flash.h b/include/spi_flash.h | ||
7307 | index 9da9062..9b0d104 100644 | ||
7308 | --- a/include/spi_flash.h | ||
7309 | +++ b/include/spi_flash.h | ||
7310 | @@ -38,6 +38,8 @@ struct spi_flash { | ||
7311 | u32 page_size; | ||
7312 | /* Erase (sector) size */ | ||
7313 | u32 sector_size; | ||
7314 | + /* To find whether single/dual spi device */ | ||
7315 | + u8 addr_width; | ||
7316 | |||
7317 | int (*read)(struct spi_flash *flash, u32 offset, | ||
7318 | size_t len, void *buf); | ||
7319 | diff --git a/include/stdio_dev.h b/include/stdio_dev.h | ||
7320 | index 932d093..9451740 100644 | ||
7321 | --- a/include/stdio_dev.h | ||
7322 | +++ b/include/stdio_dev.h | ||
7323 | @@ -99,7 +99,7 @@ struct list_head* stdio_get_list(void); | ||
7324 | struct stdio_dev* stdio_get_by_name(const char* name); | ||
7325 | struct stdio_dev* stdio_clone(struct stdio_dev *dev); | ||
7326 | |||
7327 | -#ifdef CONFIG_ARM_DCC_MULTI | ||
7328 | +#ifdef CONFIG_ARM_DCC | ||
7329 | int drv_arm_dcc_init(void); | ||
7330 | #endif | ||
7331 | #ifdef CONFIG_LCD | ||
7332 | diff --git a/include/xilinx.h b/include/xilinx.h | ||
7333 | index 5f25b7a..4cf53cb 100644 | ||
7334 | --- a/include/xilinx.h | ||
7335 | +++ b/include/xilinx.h | ||
7336 | @@ -33,10 +33,12 @@ | ||
7337 | #define CONFIG_SYS_VIRTEX_E CONFIG_SYS_FPGA_DEV( 0x2 ) | ||
7338 | #define CONFIG_SYS_VIRTEX2 CONFIG_SYS_FPGA_DEV( 0x4 ) | ||
7339 | #define CONFIG_SYS_SPARTAN3 CONFIG_SYS_FPGA_DEV( 0x8 ) | ||
7340 | +#define CONFIG_SYS_ZYNQ CONFIG_SYS_FPGA_DEV(0x10) | ||
7341 | #define CONFIG_SYS_XILINX_SPARTAN2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN2) | ||
7342 | #define CONFIG_SYS_XILINX_VIRTEX_E (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX_E) | ||
7343 | #define CONFIG_SYS_XILINX_VIRTEX2 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX2) | ||
7344 | #define CONFIG_SYS_XILINX_SPARTAN3 (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN3) | ||
7345 | +#define CONFIG_SYS_XILINX_ZYNQ (CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_ZYNQ) | ||
7346 | /* XXX - Add new models here */ | ||
7347 | |||
7348 | |||
7349 | @@ -59,6 +61,7 @@ typedef enum { /* typedef Xilinx_iface */ | ||
7350 | jtag_mode, /* jtag/tap serial (not used ) */ | ||
7351 | master_selectmap, /* master SelectMap (virtex2) */ | ||
7352 | slave_selectmap, /* slave SelectMap (virtex2) */ | ||
7353 | + devcfg, /* devcfg interface (zynq) */ | ||
7354 | max_xilinx_iface_type /* insert all new types before this */ | ||
7355 | } Xilinx_iface; /* end, typedef Xilinx_iface */ | ||
7356 | |||
7357 | @@ -68,6 +71,7 @@ typedef enum { /* typedef Xilinx_Family */ | ||
7358 | Xilinx_VirtexE, /* Virtex-E Family */ | ||
7359 | Xilinx_Virtex2, /* Virtex2 Family */ | ||
7360 | Xilinx_Spartan3, /* Spartan-III Family */ | ||
7361 | + Xilinx_Zynq, /* Zynq Family */ | ||
7362 | max_xilinx_type /* insert all new types before this */ | ||
7363 | } Xilinx_Family; /* end, typedef Xilinx_Family */ | ||
7364 | |||
7365 | -- | ||
7366 | 1.7.5.4 | ||
7367 | |||
diff --git a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0005-Xilinx-modifications-to-configs.patch b/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0005-Xilinx-modifications-to-configs.patch deleted file mode 100644 index f6445d98..00000000 --- a/recipes-bsp/u-boot/u-boot/xilinx-v2013.01/0005-Xilinx-modifications-to-configs.patch +++ /dev/null | |||
@@ -1,2333 +0,0 @@ | |||
1 | From 6272d1e2e2723000ea1e56e080e0c49495c6b126 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sipke Vriend <sipke.vriend@xilinx.com> | ||
3 | Date: Tue, 21 May 2013 07:19:13 +1000 | ||
4 | Subject: [PATCH 5/5] Xilinx modifications to configs | ||
5 | |||
6 | Signed-off-by: Sipke Vriend <sipke.vriend@xilinx.com> | ||
7 | --- | ||
8 | include/configs/fx12mm.h | 68 ----- | ||
9 | include/configs/microblaze-generic.h | 476 +++++++++++------------------- | ||
10 | include/configs/ml507.h | 49 ---- | ||
11 | include/configs/v5fx30teval.h | 49 ---- | ||
12 | include/configs/xilinx-ppc.h | 137 --------- | ||
13 | include/configs/xilinx-ppc405-generic.h | 305 ++++++++++++++++++--- | ||
14 | include/configs/xilinx-ppc405.h | 39 --- | ||
15 | include/configs/xilinx-ppc440-generic.h | 325 +++++++++++++++++++--- | ||
16 | include/configs/xilinx-ppc440.h | 28 -- | ||
17 | include/configs/zynq_afx.h | 36 +++ | ||
18 | include/configs/zynq_common.h | 300 +++++++++++++++++++ | ||
19 | include/configs/zynq_cseflash.h | 73 +++++ | ||
20 | include/configs/zynq_zc70x.h | 36 +++ | ||
21 | include/configs/zynq_zc770.h | 52 ++++ | ||
22 | include/configs/zynq_zed.h | 34 +++ | ||
23 | include/zynqpl.h | 60 ++++ | ||
24 | 16 files changed, 1325 insertions(+), 742 deletions(-) | ||
25 | delete mode 100644 include/configs/fx12mm.h | ||
26 | delete mode 100644 include/configs/ml507.h | ||
27 | delete mode 100644 include/configs/v5fx30teval.h | ||
28 | delete mode 100644 include/configs/xilinx-ppc.h | ||
29 | delete mode 100644 include/configs/xilinx-ppc405.h | ||
30 | delete mode 100644 include/configs/xilinx-ppc440.h | ||
31 | create mode 100644 include/configs/zynq_afx.h | ||
32 | create mode 100644 include/configs/zynq_common.h | ||
33 | create mode 100644 include/configs/zynq_cseflash.h | ||
34 | create mode 100644 include/configs/zynq_zc70x.h | ||
35 | create mode 100644 include/configs/zynq_zc770.h | ||
36 | create mode 100644 include/configs/zynq_zed.h | ||
37 | create mode 100644 include/zynqpl.h | ||
38 | |||
39 | diff --git a/include/configs/fx12mm.h b/include/configs/fx12mm.h | ||
40 | deleted file mode 100644 | ||
41 | index e825c21..0000000 | ||
42 | --- a/include/configs/fx12mm.h | ||
43 | +++ /dev/null | ||
44 | @@ -1,68 +0,0 @@ | ||
45 | -/* | ||
46 | - * (C) Copyright 2008 | ||
47 | - * | ||
48 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
49 | - * This work has been supported by: QTechnology http://qtec.com | ||
50 | - * | ||
51 | - * Georg Schardt <schardt@team-ctech.de> | ||
52 | - * | ||
53 | - * See file CREDITS for list of people who contributed to this | ||
54 | - * project. | ||
55 | - * | ||
56 | - * This program is free software; you can redistribute it and/or | ||
57 | - * modify it under the terms of the GNU General Public License as | ||
58 | - * published by the Free Software Foundation; either version 2 of | ||
59 | - * the License, or (at your option) any later version. | ||
60 | - * | ||
61 | - * This program is distributed in the hope that it will be useful, | ||
62 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
63 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
64 | - * GNU General Public License for more details. | ||
65 | - * | ||
66 | - * You should have received a copy of the GNU General Public License | ||
67 | - * along with this program; if not, write to the Free Software | ||
68 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
69 | - * MA 02111-1307 USA | ||
70 | - */ | ||
71 | - | ||
72 | -/* | ||
73 | - * Configuration file for the Virtex4FX12 Minimodul by Avnet/Memec, | ||
74 | - * see http://www.em.avnet.com | ||
75 | - */ | ||
76 | - | ||
77 | -#ifndef __CONFIG_FX12_H | ||
78 | -#define __CONFIG_FX12_H | ||
79 | - | ||
80 | -#include "../board/avnet/fx12mm/xparameters.h" | ||
81 | - | ||
82 | -/* cmd config */ | ||
83 | -#define CONFIG_CMD_JFFS2 | ||
84 | -#define CONFIG_CMD_MTDPARTS | ||
85 | -#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ | ||
86 | -#define CONFIG_FLASH_CFI_MTD | ||
87 | -#undef CONFIG_CMD_NET | ||
88 | - | ||
89 | -/* sdram */ | ||
90 | -#define CONFIG_SYS_SDRAM_SIZE_MB 64 | ||
91 | - | ||
92 | -/* environment */ | ||
93 | -#define CONFIG_ENV_IS_IN_FLASH 1 | ||
94 | -#define CONFIG_ENV_SIZE 0x10000 | ||
95 | -#define CONFIG_ENV_SECT_SIZE 0x10000 | ||
96 | -#define CONFIG_SYS_ENV_OFFSET 0xA0000 | ||
97 | -#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE+CONFIG_SYS_ENV_OFFSET) | ||
98 | -#define CONFIG_ENV_OVERWRITE 1 | ||
99 | - | ||
100 | -/*Misc*/ | ||
101 | -#define CONFIG_SYS_PROMPT "FX12MM:/# " /* Monitor Command Prompt */ | ||
102 | -#define CONFIG_PREBOOT "echo U-Boot is up and running;" | ||
103 | - | ||
104 | -/*Flash*/ | ||
105 | -#define CONFIG_SYS_FLASH_SIZE (4*1024*1024) | ||
106 | -#define CONFIG_SYS_MAX_FLASH_SECT 71 | ||
107 | -#define MTDIDS_DEFAULT "nor0=fx12mm-flash" | ||
108 | -#define MTDPARTS_DEFAULT "mtdparts=fx12mm-flash:-(user)" | ||
109 | - | ||
110 | -#include "configs/xilinx-ppc405.h" | ||
111 | - | ||
112 | -#endif /* __CONFIG_H */ | ||
113 | diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h | ||
114 | index eed38c1..5657582 100644 | ||
115 | --- a/include/configs/microblaze-generic.h | ||
116 | +++ b/include/configs/microblaze-generic.h | ||
117 | @@ -27,128 +27,147 @@ | ||
118 | |||
119 | #include "../board/xilinx/microblaze-generic/xparameters.h" | ||
120 | |||
121 | -/* MicroBlaze CPU */ | ||
122 | -#define CONFIG_MICROBLAZE 1 | ||
123 | + | ||
124 | +#define CONFIG_MICROBLAZE 1 /* MicroBlaze CPU */ | ||
125 | #define MICROBLAZE_V5 1 | ||
126 | |||
127 | -/* Open Firmware DTS */ | ||
128 | -#define CONFIG_OF_CONTROL 1 | ||
129 | -#define CONFIG_OF_EMBED 1 | ||
130 | -#define CONFIG_DEFAULT_DEVICE_TREE microblaze | ||
131 | +/* Memory test handling */ | ||
132 | +#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE | ||
133 | +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x1000) | ||
134 | |||
135 | -/* linear and spi flash memory */ | ||
136 | -#ifdef XILINX_FLASH_START | ||
137 | -#define FLASH | ||
138 | -#undef SPIFLASH | ||
139 | -#undef RAMENV /* hold environment in flash */ | ||
140 | -#else | ||
141 | -#ifdef XILINX_SPI_FLASH_BASEADDR | ||
142 | -#undef FLASH | ||
143 | -#define SPIFLASH | ||
144 | -#undef RAMENV /* hold environment in flash */ | ||
145 | -#else | ||
146 | -#undef FLASH | ||
147 | -#undef SPIFLASH | ||
148 | -#define RAMENV /* hold environment in RAM */ | ||
149 | -#endif | ||
150 | +/* global pointer */ | ||
151 | +/* start of global data */ | ||
152 | +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE) | ||
153 | + | ||
154 | +/* monitor code */ | ||
155 | +#define SIZE 0x40000 | ||
156 | +#define CONFIG_SYS_MONITOR_LEN SIZE | ||
157 | +#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE) | ||
158 | + | ||
159 | +#define CONFIG_SYS_MONITOR_END (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) | ||
160 | +#define CONFIG_SYS_MALLOC_LEN SIZE | ||
161 | +#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN) | ||
162 | + | ||
163 | +/* stack */ | ||
164 | +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MALLOC_BASE | ||
165 | + | ||
166 | +#define CONFIG_SYS_BOOTMAPSZ (1 << 31) /* Initial Memory map for Linux */ | ||
167 | + | ||
168 | +#undef CONFIG_PHYLIB | ||
169 | +#define CONFIG_LMB 1 | ||
170 | + | ||
171 | +/* Default cache size if not specified */ | ||
172 | +#ifndef XILINX_DCACHE_BYTE_SIZE | ||
173 | +# define XILINX_DCACHE_BYTE_SIZE 32768 | ||
174 | #endif | ||
175 | |||
176 | -/* uart */ | ||
177 | + | ||
178 | +/* The following table includes the supported baudrates */ | ||
179 | +#define CONFIG_SYS_BAUDRATE_TABLE \ | ||
180 | + {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400} | ||
181 | + | ||
182 | +/* use serial multi for all serial devices */ | ||
183 | +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 | ||
184 | + | ||
185 | #ifdef XILINX_UARTLITE_BASEADDR | ||
186 | # define CONFIG_XILINX_UARTLITE | ||
187 | -# define CONFIG_SERIAL_BASE XILINX_UARTLITE_BASEADDR | ||
188 | -# define CONFIG_BAUDRATE XILINX_UARTLITE_BAUDRATE | ||
189 | -# define CONFIG_SYS_BAUDRATE_TABLE { CONFIG_BAUDRATE } | ||
190 | -# define CONSOLE_ARG "console=console=ttyUL0,115200\0" | ||
191 | -#elif XILINX_UART16550_BASEADDR | ||
192 | -# define CONFIG_SYS_NS16550 1 | ||
193 | +# if defined(XILINX_UARTLITE_BAUDRATE) | ||
194 | +# define CONFIG_BAUDRATE XILINX_UARTLITE_BAUDRATE | ||
195 | +# endif | ||
196 | +#endif | ||
197 | + | ||
198 | +#if XILINX_UART16550_BASEADDR | ||
199 | +# define CONFIG_SYS_NS16550 1 | ||
200 | # define CONFIG_SYS_NS16550_SERIAL | ||
201 | +# define CONFIG_SYS_NS16550_COM1 ((XILINX_UART16550_BASEADDR & ~0xF) + 0x1000) | ||
202 | +# define CONFIG_SYS_NS16550_CLK XILINX_UART16550_CLOCK_HZ | ||
203 | + | ||
204 | # if defined(__MICROBLAZEEL__) | ||
205 | # define CONFIG_SYS_NS16550_REG_SIZE -4 | ||
206 | # else | ||
207 | # define CONFIG_SYS_NS16550_REG_SIZE 4 | ||
208 | # endif | ||
209 | -# define CONFIG_CONS_INDEX 1 | ||
210 | -# define CONFIG_SYS_NS16550_COM1 \ | ||
211 | - ((XILINX_UART16550_BASEADDR & ~0xF) + 0x1000) | ||
212 | -# define CONFIG_SYS_NS16550_CLK XILINX_UART16550_CLOCK_HZ | ||
213 | -# define CONFIG_BAUDRATE 115200 | ||
214 | |||
215 | -/* The following table includes the supported baudrates */ | ||
216 | -# define CONFIG_SYS_BAUDRATE_TABLE \ | ||
217 | - {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400} | ||
218 | -# define CONSOLE_ARG "console=console=ttyS0,115200\0" | ||
219 | -#else | ||
220 | -# error Undefined uart | ||
221 | +/* CONS_INDEX for system with uartlite only mustn't define CONFIG_CONS_INDEX | ||
222 | + * u-boot BSP generates CONFIG_CONS_INDEX for system with several uart16550 */ | ||
223 | +# if !defined(CONFIG_CONS_INDEX) | ||
224 | +# define CONFIG_CONS_INDEX 1 | ||
225 | +# endif | ||
226 | #endif | ||
227 | |||
228 | -/* setting reset address */ | ||
229 | -/*#define CONFIG_SYS_RESET_ADDRESS CONFIG_SYS_TEXT_BASE*/ | ||
230 | +#if !defined(CONFIG_BAUDRATE) | ||
231 | + #define CONFIG_BAUDRATE 115200 | ||
232 | +#endif | ||
233 | |||
234 | -/* ethernet */ | ||
235 | #undef CONFIG_SYS_ENET | ||
236 | +#ifdef XILINX_EMAC_BASEADDR | ||
237 | + #define CONFIG_XILINX_EMAC 1 | ||
238 | + #define CONFIG_SYS_ENET | ||
239 | +#endif | ||
240 | #if defined(XILINX_EMACLITE_BASEADDR) | ||
241 | -# define CONFIG_XILINX_EMACLITE 1 | ||
242 | -# define CONFIG_SYS_ENET | ||
243 | + #define CONFIG_XILINX_EMACLITE 1 | ||
244 | + #define CONFIG_SYS_ENET | ||
245 | #endif | ||
246 | #if defined(XILINX_LLTEMAC_BASEADDR) | ||
247 | -# define CONFIG_XILINX_LL_TEMAC 1 | ||
248 | -# define CONFIG_SYS_ENET | ||
249 | + #define CONFIG_XILINX_LL_TEMAC 1 | ||
250 | + #define CONFIG_SYS_ENET | ||
251 | #endif | ||
252 | #if defined(XILINX_AXIEMAC_BASEADDR) | ||
253 | -# define CONFIG_XILINX_AXIEMAC 1 | ||
254 | -# define CONFIG_SYS_ENET | ||
255 | + #define CONFIG_XILINX_AXIEMAC 1 | ||
256 | + #define CONFIG_SYS_ENET | ||
257 | #endif | ||
258 | |||
259 | #undef ET_DEBUG | ||
260 | |||
261 | -/* gpio */ | ||
262 | -#ifdef XILINX_GPIO_BASEADDR | ||
263 | -# define CONFIG_SYS_GPIO_0 1 | ||
264 | -# define CONFIG_SYS_GPIO_0_ADDR XILINX_GPIO_BASEADDR | ||
265 | -#endif | ||
266 | |||
267 | /* interrupt controller */ | ||
268 | #ifdef XILINX_INTC_BASEADDR | ||
269 | -# define CONFIG_SYS_INTC_0_ADDR XILINX_INTC_BASEADDR | ||
270 | -# define CONFIG_SYS_INTC_0_NUM XILINX_INTC_NUM_INTR_INPUTS | ||
271 | + #define CONFIG_SYS_INTC_0 1 | ||
272 | + #define CONFIG_SYS_INTC_0_ADDR XILINX_INTC_BASEADDR | ||
273 | + #define CONFIG_SYS_INTC_0_NUM XILINX_INTC_NUM_INTR_INPUTS | ||
274 | #endif | ||
275 | |||
276 | /* timer */ | ||
277 | -#if defined(XILINX_TIMER_BASEADDR) && defined(XILINX_TIMER_IRQ) | ||
278 | -# define CONFIG_SYS_TIMER_0_ADDR XILINX_TIMER_BASEADDR | ||
279 | -# define CONFIG_SYS_TIMER_0_IRQ XILINX_TIMER_IRQ | ||
280 | +#ifdef XILINX_TIMER_BASEADDR | ||
281 | + #if (XILINX_TIMER_IRQ != -1) | ||
282 | + #define CONFIG_SYS_TIMER_0 1 | ||
283 | + #define CONFIG_SYS_TIMER_0_ADDR XILINX_TIMER_BASEADDR | ||
284 | + #define CONFIG_SYS_TIMER_0_IRQ XILINX_TIMER_IRQ | ||
285 | + #define FREQUENCE XILINX_CLOCK_FREQ | ||
286 | + #define CONFIG_SYS_TIMER_0_PRELOAD ( FREQUENCE/1000 ) | ||
287 | + #endif | ||
288 | +#else | ||
289 | +# error Please setup TIMER in BSP | ||
290 | #endif | ||
291 | |||
292 | -/* FSL */ | ||
293 | -/* #define CONFIG_SYS_FSL_2 */ | ||
294 | -/* #define FSL_INTR_2 1 */ | ||
295 | +#if defined(XILINX_WATCHDOG_BASEADDR) && defined(XILINX_WATCHDOG_IRQ) | ||
296 | +# define CONFIG_WATCHDOG_BASEADDR XILINX_WATCHDOG_BASEADDR | ||
297 | +# define CONFIG_WATCHDOG_IRQ XILINX_WATCHDOG_IRQ | ||
298 | +# define CONFIG_HW_WATCHDOG 1 | ||
299 | +# define CONFIG_XILINX_TB_WATCHDOG 1 | ||
300 | +#endif | ||
301 | |||
302 | /* | ||
303 | * memory layout - Example | ||
304 | - * CONFIG_SYS_TEXT_BASE = 0x1200_0000; defined in config.mk | ||
305 | + * TEXT_BASE = 0x1200_0000; | ||
306 | * CONFIG_SYS_SRAM_BASE = 0x1000_0000; | ||
307 | - * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; 64MB | ||
308 | - * | ||
309 | - * CONFIG_SYS_MONITOR_LEN = 0x40000 | ||
310 | - * CONFIG_SYS_MALLOC_LEN = 3 * CONFIG_SYS_MONITOR_LEN = 0xC0000 | ||
311 | + * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; | ||
312 | * | ||
313 | * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000 | ||
314 | - * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - CONFIG_SYS_MONITOR_LEN = 0x13FB_F000 | ||
315 | - * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - CONFIG_SYS_MALLOC_LEN = 0x13EF_F000 | ||
316 | + * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - 0x40000 = 0x13FB_F000 | ||
317 | + * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - 0x40000 = 0x13F7_F000 | ||
318 | * | ||
319 | * 0x1000_0000 CONFIG_SYS_SDRAM_BASE | ||
320 | - * MEMTEST_AREA 64kB | ||
321 | * FREE | ||
322 | - * 0x1200_0000 CONFIG_SYS_TEXT_BASE | ||
323 | + * 0x1200_0000 TEXT_BASE | ||
324 | * U-BOOT code | ||
325 | * 0x1202_0000 | ||
326 | * FREE | ||
327 | * | ||
328 | * STACK | ||
329 | - * 0x13EF_F000 CONFIG_SYS_MALLOC_BASE | ||
330 | - * MALLOC_AREA 768kB Alloc | ||
331 | - * 0x13FB_F000 CONFIG_SYS_MONITOR_BASE | ||
332 | + * 0x13F7_F000 CONFIG_SYS_MALLOC_BASE | ||
333 | + * MALLOC_AREA 256kB Alloc | ||
334 | + * 0x11FB_F000 CONFIG_SYS_MONITOR_BASE | ||
335 | * MONITOR_CODE 256kB Env | ||
336 | * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET | ||
337 | * GLOBAL_DATA 4kB bd, gd | ||
338 | @@ -158,133 +177,48 @@ | ||
339 | /* ddr sdram - main memory */ | ||
340 | #define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START | ||
341 | #define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE | ||
342 | -#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE | ||
343 | -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x1000) | ||
344 | - | ||
345 | -/* global pointer */ | ||
346 | -/* start of global data */ | ||
347 | -#define CONFIG_SYS_GBL_DATA_OFFSET \ | ||
348 | - (CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE) | ||
349 | |||
350 | -/* monitor code */ | ||
351 | -#define SIZE 0x40000 | ||
352 | -#define CONFIG_SYS_MONITOR_LEN SIZE | ||
353 | -#define CONFIG_SYS_MONITOR_BASE \ | ||
354 | - (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \ | ||
355 | - - CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE) | ||
356 | -#define CONFIG_SYS_MONITOR_END \ | ||
357 | - (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) | ||
358 | -#define CONFIG_SYS_MALLOC_LEN (SIZE * 3) | ||
359 | -#define CONFIG_SYS_MALLOC_BASE \ | ||
360 | - (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN) | ||
361 | - | ||
362 | -/* stack */ | ||
363 | -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MALLOC_BASE | ||
364 | - | ||
365 | -/* | ||
366 | - * CFI flash memory layout - Example | ||
367 | - * CONFIG_SYS_FLASH_BASE = 0x2200_0000; | ||
368 | - * CONFIG_SYS_FLASH_SIZE = 0x0080_0000; 8MB | ||
369 | - * | ||
370 | - * SECT_SIZE = 0x20000; 128kB is one sector | ||
371 | - * CONFIG_ENV_SIZE = SECT_SIZE; 128kB environment store | ||
372 | - * | ||
373 | - * 0x2200_0000 CONFIG_SYS_FLASH_BASE | ||
374 | - * FREE 256kB | ||
375 | - * 0x2204_0000 CONFIG_ENV_ADDR | ||
376 | - * ENV_AREA 128kB | ||
377 | - * 0x2206_0000 | ||
378 | - * FREE | ||
379 | - * 0x2280_0000 CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE | ||
380 | - * | ||
381 | - */ | ||
382 | - | ||
383 | -#ifdef FLASH | ||
384 | -# define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START | ||
385 | -# define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE | ||
386 | -# define CONFIG_SYS_FLASH_CFI 1 | ||
387 | -# define CONFIG_FLASH_CFI_DRIVER 1 | ||
388 | -/* ?empty sector */ | ||
389 | -# define CONFIG_SYS_FLASH_EMPTY_INFO 1 | ||
390 | -/* max number of memory banks */ | ||
391 | -# define CONFIG_SYS_MAX_FLASH_BANKS 1 | ||
392 | -/* max number of sectors on one chip */ | ||
393 | -# define CONFIG_SYS_MAX_FLASH_SECT 512 | ||
394 | -/* hardware flash protection */ | ||
395 | -# define CONFIG_SYS_FLASH_PROTECTION | ||
396 | - | ||
397 | -# ifdef RAMENV | ||
398 | -# define CONFIG_ENV_IS_NOWHERE 1 | ||
399 | -# define CONFIG_ENV_SIZE 0x1000 | ||
400 | -# define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
401 | - | ||
402 | -# else /* FLASH && !RAMENV */ | ||
403 | -# define CONFIG_ENV_IS_IN_FLASH 1 | ||
404 | -/* 128K(one sector) for env */ | ||
405 | -# define CONFIG_ENV_SECT_SIZE 0x20000 | ||
406 | -# define CONFIG_ENV_ADDR \ | ||
407 | - (CONFIG_SYS_FLASH_BASE + (2 * CONFIG_ENV_SECT_SIZE)) | ||
408 | -# define CONFIG_ENV_SIZE 0x20000 | ||
409 | -# endif /* FLASH && !RAMBOOT */ | ||
410 | -#else /* !FLASH */ | ||
411 | - | ||
412 | -#ifdef SPIFLASH | ||
413 | -# define CONFIG_SYS_NO_FLASH 1 | ||
414 | -# define CONFIG_SYS_SPI_BASE XILINX_SPI_FLASH_BASEADDR | ||
415 | -# define CONFIG_XILINX_SPI 1 | ||
416 | -# define CONFIG_SPI 1 | ||
417 | -# define CONFIG_SPI_FLASH 1 | ||
418 | -# define CONFIG_SPI_FLASH_STMICRO 1 | ||
419 | -# define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 | ||
420 | -# define CONFIG_SF_DEFAULT_SPEED XILINX_SPI_FLASH_MAX_FREQ | ||
421 | -# define CONFIG_SF_DEFAULT_CS XILINX_SPI_FLASH_CS | ||
422 | - | ||
423 | -# ifdef RAMENV | ||
424 | -# define CONFIG_ENV_IS_NOWHERE 1 | ||
425 | -# define CONFIG_ENV_SIZE 0x1000 | ||
426 | -# define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
427 | - | ||
428 | -# else /* SPIFLASH && !RAMENV */ | ||
429 | -# define CONFIG_ENV_IS_IN_SPI_FLASH 1 | ||
430 | -# define CONFIG_ENV_SPI_MODE SPI_MODE_3 | ||
431 | -# define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED | ||
432 | -# define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS | ||
433 | -/* 128K(two sectors) for env */ | ||
434 | -# define CONFIG_ENV_SECT_SIZE 0x10000 | ||
435 | -# define CONFIG_ENV_SIZE (2 * CONFIG_ENV_SECT_SIZE) | ||
436 | -/* Warning: adjust the offset in respect of other flash content and size */ | ||
437 | -# define CONFIG_ENV_OFFSET (128 * CONFIG_ENV_SECT_SIZE) /* at 8MB */ | ||
438 | -# endif /* SPIFLASH && !RAMBOOT */ | ||
439 | -#else /* !SPIFLASH */ | ||
440 | - | ||
441 | -/* ENV in RAM */ | ||
442 | -# define CONFIG_SYS_NO_FLASH 1 | ||
443 | -# define CONFIG_ENV_IS_NOWHERE 1 | ||
444 | -# define CONFIG_ENV_SIZE 0x1000 | ||
445 | -# define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
446 | -#endif /* !SPIFLASH */ | ||
447 | -#endif /* !FLASH */ | ||
448 | - | ||
449 | -/* system ace */ | ||
450 | -#ifdef XILINX_SYSACE_BASEADDR | ||
451 | -# define CONFIG_SYSTEMACE | ||
452 | -/* #define DEBUG_SYSTEMACE */ | ||
453 | -# define SYSTEMACE_CONFIG_FPGA | ||
454 | -# define CONFIG_SYS_SYSTEMACE_BASE XILINX_SYSACE_BASEADDR | ||
455 | -# define CONFIG_SYS_SYSTEMACE_WIDTH XILINX_SYSACE_MEM_WIDTH | ||
456 | -# define CONFIG_DOS_PARTITION | ||
457 | +#if defined(XILINX_FLASH_START) /* Parallel Flash */ | ||
458 | + #define FLASH | ||
459 | + #define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START | ||
460 | + #define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE | ||
461 | + #define CONFIG_SYS_FLASH_CFI 1 | ||
462 | + #define CONFIG_FLASH_CFI_DRIVER 1 | ||
463 | + #define CONFIG_SYS_FLASH_EMPTY_INFO 1 /* ?empty sector */ | ||
464 | + #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ | ||
465 | + #define CONFIG_SYS_MAX_FLASH_SECT 2048 /* max number of sectors on one chip */ | ||
466 | + | ||
467 | + /* Assume env is in flash, this may be undone lower down */ | ||
468 | + #define CONFIG_ENV_IS_IN_FLASH 1 | ||
469 | + #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K(one sector) for env */ | ||
470 | + | ||
471 | + #define CONFIG_SYS_FLASH_PROTECTION | ||
472 | + | ||
473 | + #define CONFIG_ENV_ADDR XILINX_FLASH_START | ||
474 | + #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE | ||
475 | +#else /* No flash memory at all */ | ||
476 | + /* ENV in RAM */ | ||
477 | + #define RAMENV | ||
478 | + #define CONFIG_SYS_NO_FLASH 1 | ||
479 | + | ||
480 | + #define CONFIG_ENV_IS_NOWHERE 1 | ||
481 | + #undef CONFIG_ENV_IS_IN_FLASH | ||
482 | + #undef CONFIG_ENV_IS_IN_SPI_FLASH | ||
483 | + #define CONFIG_ENV_SIZE 0x1000 | ||
484 | + #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
485 | + #define CONFIG_SYS_FLASH_PROTECTION /* hardware flash protection */ | ||
486 | #endif | ||
487 | |||
488 | #if defined(XILINX_USE_ICACHE) | ||
489 | -# define CONFIG_ICACHE | ||
490 | + #define CONFIG_ICACHE | ||
491 | #else | ||
492 | -# undef CONFIG_ICACHE | ||
493 | + #undef CONFIG_ICACHE | ||
494 | #endif | ||
495 | |||
496 | #if defined(XILINX_USE_DCACHE) | ||
497 | -# define CONFIG_DCACHE | ||
498 | + #define CONFIG_DCACHE | ||
499 | #else | ||
500 | -# undef CONFIG_DCACHE | ||
501 | + #undef CONFIG_DCACHE | ||
502 | #endif | ||
503 | |||
504 | #ifndef XILINX_DCACHE_BYTE_SIZE | ||
505 | @@ -305,146 +239,86 @@ | ||
506 | #include <config_cmd_default.h> | ||
507 | |||
508 | #define CONFIG_CMD_ASKENV | ||
509 | +/* FIXME: hack for zynq */ | ||
510 | #define CONFIG_CMD_IRQ | ||
511 | -#define CONFIG_CMD_MFSL | ||
512 | #define CONFIG_CMD_ECHO | ||
513 | |||
514 | -#if defined(CONFIG_DCACHE) || defined(CONFIG_ICACHE) | ||
515 | -# define CONFIG_CMD_CACHE | ||
516 | -#else | ||
517 | -# undef CONFIG_CMD_CACHE | ||
518 | -#endif | ||
519 | - | ||
520 | +#undef CONFIG_CMD_NFS | ||
521 | +#undef CONFIG_CMD_JFFS2 | ||
522 | #ifndef CONFIG_SYS_ENET | ||
523 | -# undef CONFIG_CMD_NET | ||
524 | -# undef CONFIG_CMD_NFS | ||
525 | + #undef CONFIG_CMD_NET | ||
526 | + #undef CONFIG_NET_MULTI | ||
527 | #else | ||
528 | -# define CONFIG_CMD_PING | ||
529 | -# define CONFIG_CMD_DHCP | ||
530 | -# define CONFIG_CMD_TFTPPUT | ||
531 | -#endif | ||
532 | - | ||
533 | -#if defined(CONFIG_SYSTEMACE) | ||
534 | -# define CONFIG_CMD_EXT2 | ||
535 | -# define CONFIG_CMD_FAT | ||
536 | + #define CONFIG_CMD_PING | ||
537 | + #define CONFIG_NET_MULTI | ||
538 | #endif | ||
539 | |||
540 | #if defined(FLASH) | ||
541 | -# define CONFIG_CMD_ECHO | ||
542 | -# define CONFIG_CMD_FLASH | ||
543 | -# define CONFIG_CMD_IMLS | ||
544 | -# define CONFIG_CMD_JFFS2 | ||
545 | -# define CONFIG_CMD_UBI | ||
546 | -# undef CONFIG_CMD_UBIFS | ||
547 | - | ||
548 | -# if !defined(RAMENV) | ||
549 | -# define CONFIG_CMD_SAVEENV | ||
550 | -# define CONFIG_CMD_SAVES | ||
551 | -# endif | ||
552 | - | ||
553 | + #define CONFIG_CMD_FLASH | ||
554 | + #define CONFIG_CMD_IMLS | ||
555 | #else | ||
556 | -#if defined(SPIFLASH) | ||
557 | -# define CONFIG_CMD_SF | ||
558 | - | ||
559 | -# if !defined(RAMENV) | ||
560 | -# define CONFIG_CMD_SAVEENV | ||
561 | -# define CONFIG_CMD_SAVES | ||
562 | -# endif | ||
563 | -#else | ||
564 | -# undef CONFIG_CMD_IMLS | ||
565 | -# undef CONFIG_CMD_FLASH | ||
566 | -# undef CONFIG_CMD_JFFS2 | ||
567 | -# undef CONFIG_CMD_UBI | ||
568 | -# undef CONFIG_CMD_UBIFS | ||
569 | -#endif | ||
570 | + #undef CONFIG_CMD_IMLS | ||
571 | + #undef CONFIG_CMD_FLASH | ||
572 | + #undef CONFIG_CMD_SAVEENV | ||
573 | + #undef CONFIG_CMD_SAVES | ||
574 | #endif | ||
575 | |||
576 | -#if defined(CONFIG_CMD_JFFS2) | ||
577 | -# define CONFIG_MTD_PARTITIONS | ||
578 | -#endif | ||
579 | - | ||
580 | -#if defined(CONFIG_CMD_UBIFS) | ||
581 | -# define CONFIG_CMD_UBI | ||
582 | -# define CONFIG_LZO | ||
583 | -#endif | ||
584 | - | ||
585 | -#if defined(CONFIG_CMD_UBI) | ||
586 | -# define CONFIG_MTD_PARTITIONS | ||
587 | -# define CONFIG_RBTREE | ||
588 | -#endif | ||
589 | - | ||
590 | -#if defined(CONFIG_MTD_PARTITIONS) | ||
591 | -/* MTD partitions */ | ||
592 | -#define CONFIG_CMD_MTDPARTS /* mtdparts command line support */ | ||
593 | -#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ | ||
594 | -#define CONFIG_FLASH_CFI_MTD | ||
595 | -#define MTDIDS_DEFAULT "nor0=flash-0" | ||
596 | - | ||
597 | -/* default mtd partition table */ | ||
598 | -#define MTDPARTS_DEFAULT "mtdparts=flash-0:256k(u-boot),"\ | ||
599 | - "256k(env),3m(kernel),1m(romfs),"\ | ||
600 | - "1m(cramfs),-(jffs2)" | ||
601 | +#if !defined(RAMENV) | ||
602 | + #define CONFIG_CMD_SAVEENV | ||
603 | + #define CONFIG_CMD_SAVES | ||
604 | #endif | ||
605 | |||
606 | /* Miscellaneous configurable options */ | ||
607 | -#define CONFIG_SYS_PROMPT "U-Boot-mONStR> " | ||
608 | -/* size of console buffer */ | ||
609 | -#define CONFIG_SYS_CBSIZE 512 | ||
610 | - /* print buffer size */ | ||
611 | -#define CONFIG_SYS_PBSIZE \ | ||
612 | - (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) | ||
613 | -/* max number of command args */ | ||
614 | -#define CONFIG_SYS_MAXARGS 15 | ||
615 | +#define CONFIG_SYS_PROMPT "U-Boot> " | ||
616 | +#define CONFIG_SYS_CBSIZE 256/* Console I/O Buffer Size */ | ||
617 | +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE +\ | ||
618 | + sizeof(CONFIG_SYS_PROMPT) + 16) | ||
619 | +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | ||
620 | + /* Boot Argument Buffer Size */ | ||
621 | +#define CONFIG_SYS_MAXARGS 15 /* max number of command args */ | ||
622 | #define CONFIG_SYS_LONGHELP | ||
623 | -/* default load address */ | ||
624 | -#define CONFIG_SYS_LOAD_ADDR XILINX_RAM_START | ||
625 | +#define CONFIG_SYS_LOAD_ADDR XILINX_RAM_START /* default load address */ | ||
626 | |||
627 | -#define CONFIG_BOOTDELAY -1 /* -1 disables auto-boot */ | ||
628 | -#define CONFIG_BOOTARGS "root=romfs" | ||
629 | +#define CONFIG_BOOTDELAY 4 | ||
630 | +/* Don't define BOOTARGS, we get it from the DTB chosen fragment */ | ||
631 | +#undef CONFIG_BOOTARGS | ||
632 | #define CONFIG_HOSTNAME XILINX_BOARD_NAME | ||
633 | -#define CONFIG_BOOTCOMMAND "base 0;tftp 11000000 image.img;bootm" | ||
634 | -#define CONFIG_IPADDR 192.168.0.3 | ||
635 | -#define CONFIG_SERVERIP 192.168.0.5 | ||
636 | -#define CONFIG_GATEWAYIP 192.168.0.1 | ||
637 | -#define CONFIG_ETHADDR 00:E0:0C:00:00:FD | ||
638 | + | ||
639 | +#define CONFIG_BOOTCOMMAND "" | ||
640 | |||
641 | /* architecture dependent code */ | ||
642 | #define CONFIG_SYS_USR_EXCEP /* user exception */ | ||
643 | -#define CONFIG_SYS_HZ 1000 | ||
644 | +#define CONFIG_SYS_HZ 1000 | ||
645 | |||
646 | -#define CONFIG_PREBOOT "echo U-BOOT for ${hostname};setenv preboot;echo" | ||
647 | - | ||
648 | -#define CONFIG_EXTRA_ENV_SETTINGS "unlock=yes\0" \ | ||
649 | - "nor0=flash-0\0"\ | ||
650 | - "mtdparts=mtdparts=flash-0:"\ | ||
651 | - "256k(u-boot),256k(env),3m(kernel),"\ | ||
652 | - "1m(romfs),1m(cramfs),-(jffs2)\0" | ||
653 | +#define CONFIG_ENV_OVERWRITE /* Allow to overwrite the u-boot environment variables */ | ||
654 | +#define CONFIG_IPADDR 192.168.0.90 | ||
655 | +#define CONFIG_SERVERIP 192.168.0.101 | ||
656 | +#define CONFIG_ETHADDR 00:0a:35:00:92:d4 | ||
657 | +#define CONFIG_BOOTP_SERVERIP | ||
658 | |||
659 | #define CONFIG_CMDLINE_EDITING | ||
660 | |||
661 | /* Use the HUSH parser */ | ||
662 | -#define CONFIG_SYS_HUSH_PARSER | ||
663 | +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " | ||
664 | |||
665 | -/* Enable flat device tree support */ | ||
666 | -#define CONFIG_LMB 1 | ||
667 | #define CONFIG_FIT 1 | ||
668 | #define CONFIG_OF_LIBFDT 1 | ||
669 | |||
670 | #if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC) | ||
671 | -# define CONFIG_MII 1 | ||
672 | -# define CONFIG_CMD_MII 1 | ||
673 | -# define CONFIG_PHY_GIGE 1 | ||
674 | -# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN 1 | ||
675 | -# define CONFIG_PHYLIB 1 | ||
676 | -# define CONFIG_PHY_ATHEROS 1 | ||
677 | -# define CONFIG_PHY_BROADCOM 1 | ||
678 | -# define CONFIG_PHY_DAVICOM 1 | ||
679 | -# define CONFIG_PHY_LXT 1 | ||
680 | -# define CONFIG_PHY_MARVELL 1 | ||
681 | -# define CONFIG_PHY_MICREL 1 | ||
682 | -# define CONFIG_PHY_NATSEMI 1 | ||
683 | -# define CONFIG_PHY_REALTEK 1 | ||
684 | -# define CONFIG_PHY_VITESSE 1 | ||
685 | +# define CONFIG_MII 1 | ||
686 | +# define CONFIG_CMD_MII 1 | ||
687 | +# define CONFIG_PHY_GIGE 1 | ||
688 | +# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN 1 | ||
689 | +# define CONFIG_PHYLIB 1 | ||
690 | +# define CONFIG_PHY_ATHEROS 1 | ||
691 | +# define CONFIG_PHY_BROADCOM 1 | ||
692 | +# define CONFIG_PHY_DAVICOM 1 | ||
693 | +# define CONFIG_PHY_LXT 1 | ||
694 | +# define CONFIG_PHY_MARVELL 1 | ||
695 | +# define CONFIG_PHY_MICREL 1 | ||
696 | +# define CONFIG_PHY_NATSEMI 1 | ||
697 | +# define CONFIG_PHY_REALTEK 1 | ||
698 | +# define CONFIG_PHY_VITESSE 1 | ||
699 | #else | ||
700 | # undef CONFIG_MII | ||
701 | # undef CONFIG_CMD_MII | ||
702 | diff --git a/include/configs/ml507.h b/include/configs/ml507.h | ||
703 | deleted file mode 100644 | ||
704 | index a7319e4..0000000 | ||
705 | --- a/include/configs/ml507.h | ||
706 | +++ /dev/null | ||
707 | @@ -1,49 +0,0 @@ | ||
708 | -/* | ||
709 | - * (C) Copyright 2008 | ||
710 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
711 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
712 | - * This program is free software: you can redistribute it and/or modify | ||
713 | - * it under the terms of the GNU General Public License as published by | ||
714 | - * the Free Software Foundation, either version 2 of the License, or | ||
715 | - * (at your option) any later version. | ||
716 | - * | ||
717 | - * This program is distributed in the hope that it will be useful, | ||
718 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
719 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
720 | - * GNU General Public License for more details. | ||
721 | - * You should have received a copy of the GNU General Public License | ||
722 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
723 | -*/ | ||
724 | - | ||
725 | -#ifndef __CONFIG_H | ||
726 | -#define __CONFIG_H | ||
727 | - | ||
728 | -/*CPU*/ | ||
729 | -#define CONFIG_440 1 | ||
730 | -#define CONFIG_XILINX_ML507 1 | ||
731 | -#include "../board/xilinx/ml507/xparameters.h" | ||
732 | - | ||
733 | -/*Mem Map*/ | ||
734 | -#define CONFIG_SYS_SDRAM_SIZE_MB 256 | ||
735 | - | ||
736 | -/*Env*/ | ||
737 | -#define CONFIG_ENV_IS_IN_FLASH 1 | ||
738 | -#define CONFIG_ENV_SIZE 0x20000 | ||
739 | -#define CONFIG_ENV_SECT_SIZE 0x20000 | ||
740 | -#define CONFIG_ENV_OFFSET 0x340000 | ||
741 | -#define CONFIG_ENV_ADDR (XPAR_FLASH_MEM0_BASEADDR+CONFIG_ENV_OFFSET) | ||
742 | - | ||
743 | -/*Misc*/ | ||
744 | -#define CONFIG_SYS_PROMPT "ml507:/# " /* Monitor Command Prompt */ | ||
745 | -#define CONFIG_PREBOOT "echo U-Boot is up and runnining;" | ||
746 | - | ||
747 | -/*Flash*/ | ||
748 | -#define CONFIG_SYS_FLASH_SIZE (32*1024*1024) | ||
749 | -#define CONFIG_SYS_MAX_FLASH_SECT 259 | ||
750 | -#define MTDIDS_DEFAULT "nor0=ml507-flash" | ||
751 | -#define MTDPARTS_DEFAULT "mtdparts=ml507-flash:-(user)" | ||
752 | - | ||
753 | -/*Generic Configs*/ | ||
754 | -#include <configs/xilinx-ppc440.h> | ||
755 | - | ||
756 | -#endif /* __CONFIG_H */ | ||
757 | diff --git a/include/configs/v5fx30teval.h b/include/configs/v5fx30teval.h | ||
758 | deleted file mode 100644 | ||
759 | index d300c4b..0000000 | ||
760 | --- a/include/configs/v5fx30teval.h | ||
761 | +++ /dev/null | ||
762 | @@ -1,49 +0,0 @@ | ||
763 | -/* | ||
764 | - * (C) Copyright 2008 | ||
765 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
766 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
767 | - * This program is free software: you can redistribute it and/or modify | ||
768 | - * it under the terms of the GNU General Public License as published by | ||
769 | - * the Free Software Foundation, either version 2 of the License, or | ||
770 | - * (at your option) any later version. | ||
771 | - * | ||
772 | - * This program is distributed in the hope that it will be useful, | ||
773 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
774 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
775 | - * GNU General Public License for more details. | ||
776 | - * You should have received a copy of the GNU General Public License | ||
777 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
778 | -*/ | ||
779 | - | ||
780 | -#ifndef __CONFIG_H | ||
781 | -#define __CONFIG_H | ||
782 | - | ||
783 | -/*CPU*/ | ||
784 | -#define CONFIG_440 1 | ||
785 | -#define CONFIG_XILINX_ML507 1 | ||
786 | -#include "../board/avnet/v5fx30teval/xparameters.h" | ||
787 | - | ||
788 | -/*Mem Map*/ | ||
789 | -#define CONFIG_SYS_SDRAM_SIZE_MB 64 | ||
790 | - | ||
791 | -/*Env*/ | ||
792 | -#define CONFIG_ENV_IS_IN_FLASH 1 | ||
793 | -#define CONFIG_ENV_SIZE 0x20000 | ||
794 | -#define CONFIG_ENV_SECT_SIZE 0x20000 | ||
795 | -#define CONFIG_ENV_OFFSET 0x1A0000 | ||
796 | -#define CONFIG_ENV_ADDR (XPAR_FLASH_MEM0_BASEADDR+CONFIG_ENV_OFFSET) | ||
797 | - | ||
798 | -/*Misc*/ | ||
799 | -#define CONFIG_SYS_PROMPT "v5fx30t:/# " /* Monitor Command Prompt */ | ||
800 | -#define CONFIG_PREBOOT "echo U-Boot is up and runnining;" | ||
801 | - | ||
802 | -/*Flash*/ | ||
803 | -#define CONFIG_SYS_FLASH_SIZE (16*1024*1024) | ||
804 | -#define CONFIG_SYS_MAX_FLASH_SECT 131 | ||
805 | -#define MTDIDS_DEFAULT "nor0=v5fx30t-flash" | ||
806 | -#define MTDPARTS_DEFAULT "mtdparts=v5fx30t-flash:-(user)" | ||
807 | - | ||
808 | -/*Generic Configs*/ | ||
809 | -#include <configs/xilinx-ppc440.h> | ||
810 | - | ||
811 | -#endif /* __CONFIG_H */ | ||
812 | diff --git a/include/configs/xilinx-ppc.h b/include/configs/xilinx-ppc.h | ||
813 | deleted file mode 100644 | ||
814 | index 2bdaa05..0000000 | ||
815 | --- a/include/configs/xilinx-ppc.h | ||
816 | +++ /dev/null | ||
817 | @@ -1,137 +0,0 @@ | ||
818 | -/* | ||
819 | - * (C) Copyright 2008 | ||
820 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
821 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
822 | - * | ||
823 | - * (C) Copyright 2008 | ||
824 | - * Georg Schardt <schardt@team-ctech.de> | ||
825 | - * | ||
826 | - * This program is free software: you can redistribute it and/or modify | ||
827 | - * it under the terms of the GNU General Public License as published by | ||
828 | - * the Free Software Foundation, either version 2 of the License, or | ||
829 | - * (at your option) any later version. | ||
830 | - * | ||
831 | - * This program is distributed in the hope that it will be useful, | ||
832 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
833 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
834 | - * GNU General Public License for more details. | ||
835 | - * You should have received a copy of the GNU General Public License | ||
836 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
837 | -*/ | ||
838 | - | ||
839 | -#ifndef __CONFIG_XLX_H | ||
840 | -#define __CONFIG_XLX_H | ||
841 | -/* | ||
842 | -#define DEBUG | ||
843 | -#define ET_DEBUG | ||
844 | -*/ | ||
845 | - | ||
846 | -/*Mem Map*/ | ||
847 | -#define CONFIG_SYS_SDRAM_BASE 0x0 | ||
848 | -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE | ||
849 | -#define CONFIG_SYS_MONITOR_LEN (192 * 1024) | ||
850 | -#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024) | ||
851 | - | ||
852 | -/*Cmd*/ | ||
853 | -#include <config_cmd_default.h> | ||
854 | -#define CONFIG_CMD_ASKENV | ||
855 | -#define CONFIG_CMD_CACHE | ||
856 | -#define CONFIG_CMD_DIAG | ||
857 | -#define CONFIG_CMD_ELF | ||
858 | -#define CONFIG_CMD_IRQ | ||
859 | -#define CONFIG_CMD_REGINFO | ||
860 | -#undef CONFIG_CMD_JFFS2 | ||
861 | -#undef CONFIG_CMD_MTDPARTS | ||
862 | -#undef CONFIG_CMD_SPI | ||
863 | -#undef CONFIG_CMD_I2C | ||
864 | -#undef CONFIG_CMD_DTT | ||
865 | -#undef CONFIG_CMD_NET | ||
866 | -#undef CONFIG_CMD_PING | ||
867 | -#undef CONFIG_CMD_DHCP | ||
868 | -#undef CONFIG_CMD_EEPROM | ||
869 | -#undef CONFIG_CMD_IMLS | ||
870 | -#undef CONFIG_CMD_NFS | ||
871 | - | ||
872 | -/*Misc*/ | ||
873 | -#define CONFIG_BOOTDELAY 5/* autoboot after 5 seconds */ | ||
874 | -#define CONFIG_SYS_LONGHELP /* undef to save memory */ | ||
875 | -#if defined(CONFIG_CMD_KGDB) | ||
876 | -#define CONFIG_SYS_CBSIZE 1024/* Console I/O Buffer Size */ | ||
877 | -#else | ||
878 | -#define CONFIG_SYS_CBSIZE 256/* Console I/O Buffer Size */ | ||
879 | -#endif | ||
880 | -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE +\ | ||
881 | - sizeof(CONFIG_SYS_PROMPT) + 16) | ||
882 | -#define CONFIG_SYS_MAXARGS 16 | ||
883 | - /* max number of command args */ | ||
884 | -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | ||
885 | - /* Boot Argument Buffer Size */ | ||
886 | -#define CONFIG_SYS_MEMTEST_START 0x00400000 | ||
887 | - /* memtest works on */ | ||
888 | -#define CONFIG_SYS_MEMTEST_END 0x00C00000 | ||
889 | - /* 4 ... 12 MB in DRAM */ | ||
890 | -#define CONFIG_SYS_LOAD_ADDR 0x00400000 | ||
891 | - /* default load address */ | ||
892 | -#define CONFIG_SYS_EXTBDINFO 1 | ||
893 | - /* Extended board_into (bd_t) */ | ||
894 | -#define CONFIG_SYS_HZ 1000 | ||
895 | - /* decrementer freq: 1 ms ticks */ | ||
896 | -#define CONFIG_CMDLINE_EDITING /* add command line history */ | ||
897 | -#define CONFIG_AUTO_COMPLETE /* add autocompletion support */ | ||
898 | -#define CONFIG_LOOPW /* enable loopw command */ | ||
899 | -#define CONFIG_MX_CYCLIC /* enable mdc/mwc commands */ | ||
900 | -#define CONFIG_ZERO_BOOTDELAY_CHECK /* check for keypress on bootdelay==0 */ | ||
901 | -#define CONFIG_VERSION_VARIABLE /* include version env variable */ | ||
902 | -#define CONFIG_SYS_CONSOLE_INFO_QUIET /* don't print console @ startup */ | ||
903 | -#define CONFIG_SYS_HUSH_PARSER /* Use the HUSH parser */ | ||
904 | -#define CONFIG_LOADS_ECHO /* echo on for serial download */ | ||
905 | -#define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate change */ | ||
906 | -#define CONFIG_SYS_BOOTMAPSZ (8 << 20) | ||
907 | - /* Initial Memory map for Linux */ | ||
908 | - | ||
909 | -/*Stack*/ | ||
910 | -#define CONFIG_SYS_INIT_RAM_ADDR 0x800000/* Initial RAM address */ | ||
911 | -#define CONFIG_SYS_INIT_RAM_SIZE 0x2000 /* Size of used area in RAM */ | ||
912 | -#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE \ | ||
913 | - - GENERATED_GBL_DATA_SIZE) | ||
914 | -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET | ||
915 | -/*Speed*/ | ||
916 | -#define CONFIG_SYS_CLK_FREQ XPAR_CORE_CLOCK_FREQ_HZ | ||
917 | - | ||
918 | -/*Flash*/ | ||
919 | -#ifdef XPAR_FLASH_MEM0_BASEADDR | ||
920 | -#define CONFIG_SYS_FLASH_BASE XPAR_FLASH_MEM0_BASEADDR | ||
921 | -#define CONFIG_SYS_FLASH_CFI 1 | ||
922 | -#define CONFIG_FLASH_CFI_DRIVER 1 | ||
923 | -#define CONFIG_SYS_FLASH_EMPTY_INFO 1 | ||
924 | -#define CONFIG_SYS_MAX_FLASH_BANKS 1 | ||
925 | -#define CONFIG_SYS_FLASH_PROTECTION | ||
926 | -#define CONFIG_CMD_JFFS2 | ||
927 | -#define CONFIG_CMD_MTDPARTS | ||
928 | -#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ | ||
929 | -#define CONFIG_FLASH_CFI_MTD | ||
930 | -#else | ||
931 | -#define CONFIG_ENV_IS_NOWHERE | ||
932 | -#define CONFIG_SYS_NO_FLASH | ||
933 | -#endif | ||
934 | - | ||
935 | -/* serial communication */ | ||
936 | -#ifdef XPAR_UARTLITE_0_BASEADDR | ||
937 | -#define CONFIG_XILINX_UARTLITE | ||
938 | -#define XILINX_UARTLITE_BASEADDR XPAR_UARTLITE_0_BASEADDR | ||
939 | -#define CONFIG_BAUDRATE XPAR_UARTLITE_0_BAUDRATE | ||
940 | -#define CONFIG_SYS_BAUDRATE_TABLE { CONFIG_BAUDRATE } | ||
941 | -#else | ||
942 | -#ifdef XPAR_UARTNS550_0_BASEADDR | ||
943 | -#define CONFIG_SYS_NS16550 | ||
944 | -#define CONFIG_SYS_NS16550_SERIAL | ||
945 | -#define CONFIG_SYS_NS16550_REG_SIZE 4 | ||
946 | -#define CONFIG_CONS_INDEX 1 | ||
947 | -#define CONFIG_SYS_NS16550_COM1 XPAR_UARTNS550_0_BASEADDR | ||
948 | -#define CONFIG_SYS_NS16550_CLK XPAR_UARTNS550_0_CLOCK_FREQ_HZ | ||
949 | -#define CONFIG_BAUDRATE 115200 | ||
950 | -#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 115200 } | ||
951 | -#endif | ||
952 | -#endif | ||
953 | - | ||
954 | -#endif /* __CONFIG_H */ | ||
955 | diff --git a/include/configs/xilinx-ppc405-generic.h b/include/configs/xilinx-ppc405-generic.h | ||
956 | index 5036c62..000afe5 100644 | ||
957 | --- a/include/configs/xilinx-ppc405-generic.h | ||
958 | +++ b/include/configs/xilinx-ppc405-generic.h | ||
959 | @@ -1,11 +1,7 @@ | ||
960 | /* | ||
961 | + * (C) Copyright 2007-2010 Michal Simek | ||
962 | * | ||
963 | - * (C) Copyright 2008 | ||
964 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
965 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
966 | - * | ||
967 | - * (C) Copyright 2008 | ||
968 | - * Georg Schardt <schardt@team-ctech.de> | ||
969 | + * Michal SIMEK <monstr@monstr.eu> | ||
970 | * | ||
971 | * See file CREDITS for list of people who contributed to this | ||
972 | * project. | ||
973 | @@ -25,34 +21,275 @@ | ||
974 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
975 | * MA 02111-1307 USA | ||
976 | */ | ||
977 | -#ifndef __CONFIG_GEN_H | ||
978 | -#define __CONFIG_GEN_H | ||
979 | + | ||
980 | +#ifndef __CONFIG_H | ||
981 | +#define __CONFIG_H | ||
982 | |||
983 | #include "../board/xilinx/ppc405-generic/xparameters.h" | ||
984 | |||
985 | -/* sdram */ | ||
986 | -#define CONFIG_SYS_SDRAM_SIZE_MB 256 | ||
987 | - | ||
988 | -/* environment */ | ||
989 | -#define CONFIG_ENV_IS_IN_FLASH 1 | ||
990 | -#define CONFIG_ENV_SIZE 0x10000 | ||
991 | -#define CONFIG_ENV_SECT_SIZE 0x10000 | ||
992 | -#define CONFIG_SYS_ENV_OFFSET 0x3F0000 | ||
993 | -#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE+CONFIG_SYS_ENV_OFFSET) | ||
994 | -#define CONFIG_ENV_OVERWRITE 1 | ||
995 | - | ||
996 | -/*Misc*/ | ||
997 | -#define CONFIG_SYS_PROMPT "xlx-ppc405:/# " /* Monitor Command Prompt */ | ||
998 | -#define CONFIG_PREBOOT "echo U-Boot is up and runnining;" | ||
999 | - | ||
1000 | -/*Flash*/ | ||
1001 | -#define CONFIG_SYS_FLASH_BASE XPAR_FLASH_MEM0_BASEADDR | ||
1002 | -#define CONFIG_SYS_FLASH_SIZE (32*1024*1024) | ||
1003 | -#define CONFIG_SYS_MAX_FLASH_SECT 71 | ||
1004 | -#define CONFIG_SYS_FLASH_CFI 1 | ||
1005 | -#define CONFIG_FLASH_CFI_DRIVER 1 | ||
1006 | -#define MTDIDS_DEFAULT "nor0=ppc405-flash" | ||
1007 | -#define MTDPARTS_DEFAULT "mtdpartsa=ppc405-flash:-(user)" | ||
1008 | - | ||
1009 | -#include <configs/xilinx-ppc405.h> | ||
1010 | -#endif /* __CONFIG_H */ | ||
1011 | +/* cpu parameter */ | ||
1012 | +#define CONFIG_405 1 | ||
1013 | +#define CONFIG_4xx 1 | ||
1014 | +#define CONFIG_XILINX_405 1 | ||
1015 | + | ||
1016 | +/* PPC-specific memory layout */ | ||
1017 | +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE | ||
1018 | +#define CONFIG_SYS_MONITOR_LEN (192 * 1024) | ||
1019 | +#define CONFIG_SYS_MALLOC_LEN (128 * 1024) | ||
1020 | + | ||
1021 | +/*Stack*/ | ||
1022 | +#define CONFIG_SYS_INIT_RAM_ADDR 0x800000/* Initial RAM address */ | ||
1023 | +#define CONFIG_SYS_INIT_RAM_END 0x2000 /* End of used area in RAM */ | ||
1024 | +#define CONFIG_SYS_GBL_DATA_SIZE 128 /* num bytes initial data */ | ||
1025 | +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END \ | ||
1026 | + - CONFIG_SYS_GBL_DATA_SIZE) | ||
1027 | +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET | ||
1028 | + | ||
1029 | +/*Speed*/ | ||
1030 | +#define CONFIG_SYS_CLK_FREQ XPAR_CORE_CLOCK_FREQ_HZ | ||
1031 | + | ||
1032 | +/* Common PPC-specific settings */ | ||
1033 | +#define CONFIG_SYS_MEMTEST_START 0x00400000 | ||
1034 | + /* memtest works on */ | ||
1035 | +#define CONFIG_SYS_MEMTEST_END 0x00C00000 | ||
1036 | + /* 4 ... 12 MB in DRAM */ | ||
1037 | +#define CONFIG_SYS_EXTBDINFO 1 | ||
1038 | + /* Extended board_into (bd_t) */ | ||
1039 | +#define CONFIG_SYS_HZ 1000 | ||
1040 | + /* decrementer freq: 1 ms ticks */ | ||
1041 | +#define CONFIG_SYS_BOOTMAPSZ (8 << 20) | ||
1042 | + /* Initial Memory map for Linux */ | ||
1043 | + | ||
1044 | +/* The following table includes the supported baudrates */ | ||
1045 | +#define CONFIG_SYS_BAUDRATE_TABLE \ | ||
1046 | + {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400} | ||
1047 | + | ||
1048 | +/* use serial multi for all serial devices */ | ||
1049 | +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 | ||
1050 | + | ||
1051 | +#ifdef XILINX_UARTLITE_BASEADDR | ||
1052 | +# define CONFIG_XILINX_UARTLITE | ||
1053 | +# if defined(XILINX_UARTLITE_BAUDRATE) | ||
1054 | +# define CONFIG_BAUDRATE XILINX_UARTLITE_BAUDRATE | ||
1055 | +# endif | ||
1056 | +#endif | ||
1057 | + | ||
1058 | +#if XILINX_UART16550_BASEADDR | ||
1059 | +# define CONFIG_SYS_NS16550 1 | ||
1060 | +# define CONFIG_SYS_NS16550_SERIAL | ||
1061 | +# define CONFIG_SYS_NS16550_COM1 ((XILINX_UART16550_BASEADDR & ~0xF) + 0x1000) | ||
1062 | +# define CONFIG_SYS_NS16550_CLK XILINX_UART16550_CLOCK_HZ | ||
1063 | + | ||
1064 | +# if defined(__MICROBLAZEEL__) | ||
1065 | +# define CONFIG_SYS_NS16550_REG_SIZE -4 | ||
1066 | +# else | ||
1067 | +# define CONFIG_SYS_NS16550_REG_SIZE 4 | ||
1068 | +# endif | ||
1069 | + | ||
1070 | +/* CONS_INDEX for system with uartlite only mustn't define CONFIG_CONS_INDEX | ||
1071 | + * u-boot BSP generates CONFIG_CONS_INDEX for system with several uart16550 */ | ||
1072 | +# if !defined(CONFIG_CONS_INDEX) | ||
1073 | +# define CONFIG_CONS_INDEX 1 | ||
1074 | +# endif | ||
1075 | +#endif | ||
1076 | + | ||
1077 | +#if !defined(CONFIG_BAUDRATE) | ||
1078 | + #define CONFIG_BAUDRATE 115200 | ||
1079 | +#endif | ||
1080 | + | ||
1081 | +#undef CONFIG_SYS_ENET | ||
1082 | +#if defined(XILINX_EMACLITE_BASEADDR) | ||
1083 | + #define CONFIG_XILINX_EMACLITE 1 | ||
1084 | + #define CONFIG_SYS_ENET | ||
1085 | +#endif | ||
1086 | +#if defined(XILINX_LLTEMAC_BASEADDR) | ||
1087 | + #define CONFIG_XILINX_LL_TEMAC 1 | ||
1088 | + #define CONFIG_SYS_ENET | ||
1089 | +#endif | ||
1090 | + | ||
1091 | +#undef ET_DEBUG | ||
1092 | + | ||
1093 | + | ||
1094 | +/* interrupt controller */ | ||
1095 | +#ifdef XILINX_INTC_BASEADDR | ||
1096 | + #define CONFIG_SYS_INTC_0 1 | ||
1097 | + #define CONFIG_SYS_INTC_0_ADDR XILINX_INTC_BASEADDR | ||
1098 | + #define CONFIG_SYS_INTC_0_NUM XILINX_INTC_NUM_INTR_INPUTS | ||
1099 | +#endif | ||
1100 | + | ||
1101 | +/* timer */ | ||
1102 | +#ifdef XILINX_TIMER_BASEADDR | ||
1103 | + #if (XILINX_TIMER_IRQ != -1) | ||
1104 | + #define CONFIG_SYS_TIMER_0 1 | ||
1105 | + #define CONFIG_SYS_TIMER_0_ADDR XILINX_TIMER_BASEADDR | ||
1106 | + #define CONFIG_SYS_TIMER_0_IRQ XILINX_TIMER_IRQ | ||
1107 | + #define FREQUENCE XILINX_CLOCK_FREQ | ||
1108 | + #define CONFIG_SYS_TIMER_0_PRELOAD ( FREQUENCE/1000 ) | ||
1109 | + #endif | ||
1110 | +#else | ||
1111 | +# error Please setup TIMER in BSP | ||
1112 | +#endif | ||
1113 | + | ||
1114 | +/* | ||
1115 | + * memory layout - Example | ||
1116 | + * TEXT_BASE = 0x1200_0000; | ||
1117 | + * CONFIG_SYS_SRAM_BASE = 0x1000_0000; | ||
1118 | + * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; | ||
1119 | + * | ||
1120 | + * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000 | ||
1121 | + * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - 0x40000 = 0x13FB_F000 | ||
1122 | + * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - 0x40000 = 0x13F7_F000 | ||
1123 | + * | ||
1124 | + * 0x1000_0000 CONFIG_SYS_SDRAM_BASE | ||
1125 | + * FREE | ||
1126 | + * 0x1200_0000 TEXT_BASE | ||
1127 | + * U-BOOT code | ||
1128 | + * 0x1202_0000 | ||
1129 | + * FREE | ||
1130 | + * | ||
1131 | + * STACK | ||
1132 | + * 0x13F7_F000 CONFIG_SYS_MALLOC_BASE | ||
1133 | + * MALLOC_AREA 256kB Alloc | ||
1134 | + * 0x11FB_F000 CONFIG_SYS_MONITOR_BASE | ||
1135 | + * MONITOR_CODE 256kB Env | ||
1136 | + * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET | ||
1137 | + * GLOBAL_DATA 4kB bd, gd | ||
1138 | + * 0x1400_0000 CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE | ||
1139 | + */ | ||
1140 | + | ||
1141 | +/* ddr sdram - main memory */ | ||
1142 | +#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START | ||
1143 | +#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE | ||
1144 | + | ||
1145 | +#if defined(XILINX_FLASH_START) /* Parallel Flash */ | ||
1146 | + #define FLASH | ||
1147 | + #define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START | ||
1148 | + #define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE | ||
1149 | + #define CONFIG_SYS_FLASH_CFI 1 | ||
1150 | + #define CONFIG_FLASH_CFI_DRIVER 1 | ||
1151 | + #define CONFIG_SYS_FLASH_EMPTY_INFO 1 /* ?empty sector */ | ||
1152 | + #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ | ||
1153 | + #define CONFIG_SYS_MAX_FLASH_SECT 2048 /* max number of sectors on one chip */ | ||
1154 | + | ||
1155 | + /* Assume env is in flash, this may be undone lower down */ | ||
1156 | + #define CONFIG_ENV_IS_IN_FLASH 1 | ||
1157 | + #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K(one sector) for env */ | ||
1158 | + | ||
1159 | + #define CONFIG_SYS_FLASH_PROTECTION | ||
1160 | + | ||
1161 | + #define CONFIG_ENV_ADDR XILINX_FLASH_START | ||
1162 | + #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE | ||
1163 | +#else /* No flash memory at all */ | ||
1164 | + /* ENV in RAM */ | ||
1165 | + #define RAMENV | ||
1166 | + #define CONFIG_SYS_NO_FLASH 1 | ||
1167 | + | ||
1168 | + #define CONFIG_ENV_IS_NOWHERE 1 | ||
1169 | + #undef CONFIG_ENV_IS_IN_FLASH | ||
1170 | + #undef CONFIG_ENV_IS_IN_SPI_FLASH | ||
1171 | + #define CONFIG_ENV_SIZE 0x1000 | ||
1172 | + #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
1173 | + #define CONFIG_SYS_FLASH_PROTECTION /* hardware flash protection */ | ||
1174 | +#endif | ||
1175 | + | ||
1176 | +/* | ||
1177 | + * BOOTP options | ||
1178 | + */ | ||
1179 | +#define CONFIG_BOOTP_BOOTFILESIZE | ||
1180 | +#define CONFIG_BOOTP_BOOTPATH | ||
1181 | +#define CONFIG_BOOTP_GATEWAY | ||
1182 | +#define CONFIG_BOOTP_HOSTNAME | ||
1183 | + | ||
1184 | +/* | ||
1185 | + * Command line configuration. | ||
1186 | + */ | ||
1187 | +#include <config_cmd_default.h> | ||
1188 | + | ||
1189 | +#define CONFIG_CMD_ASKENV | ||
1190 | +/* FIXME: hack for zynq */ | ||
1191 | +#define CONFIG_CMD_IRQ | ||
1192 | +#define CONFIG_CMD_ECHO | ||
1193 | + | ||
1194 | +#undef CONFIG_CMD_NFS | ||
1195 | +#undef CONFIG_CMD_JFFS2 | ||
1196 | +#ifndef CONFIG_SYS_ENET | ||
1197 | + #undef CONFIG_CMD_NET | ||
1198 | + #undef CONFIG_NET_MULTI | ||
1199 | +#else | ||
1200 | + #define CONFIG_CMD_PING | ||
1201 | + #define CONFIG_NET_MULTI | ||
1202 | +#endif | ||
1203 | + | ||
1204 | +#if defined(FLASH) | ||
1205 | + #define CONFIG_CMD_FLASH | ||
1206 | + #define CONFIG_CMD_IMLS | ||
1207 | +#else | ||
1208 | + #undef CONFIG_CMD_IMLS | ||
1209 | + #undef CONFIG_CMD_FLASH | ||
1210 | + #undef CONFIG_CMD_SAVEENV | ||
1211 | + #undef CONFIG_CMD_SAVES | ||
1212 | +#endif | ||
1213 | + | ||
1214 | +#if !defined(RAMENV) | ||
1215 | + #define CONFIG_CMD_SAVEENV | ||
1216 | + #define CONFIG_CMD_SAVES | ||
1217 | +#endif | ||
1218 | + | ||
1219 | +/* Miscellaneous configurable options */ | ||
1220 | +#define CONFIG_SYS_PROMPT "U-Boot> " | ||
1221 | +#define CONFIG_SYS_CBSIZE 256/* Console I/O Buffer Size */ | ||
1222 | +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE +\ | ||
1223 | + sizeof(CONFIG_SYS_PROMPT) + 16) | ||
1224 | +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | ||
1225 | + /* Boot Argument Buffer Size */ | ||
1226 | +#define CONFIG_SYS_MAXARGS 15 /* max number of command args */ | ||
1227 | +#define CONFIG_SYS_LONGHELP | ||
1228 | +#define CONFIG_SYS_LOAD_ADDR XILINX_RAM_START /* default load address */ | ||
1229 | + | ||
1230 | +#define CONFIG_BOOTDELAY 4 | ||
1231 | +/* Don't define BOOTARGS, we get it from the DTB chosen fragment */ | ||
1232 | +#undef CONFIG_BOOTARGS | ||
1233 | +#define CONFIG_HOSTNAME XILINX_BOARD_NAME | ||
1234 | + | ||
1235 | +#define CONFIG_BOOTCOMMAND "" | ||
1236 | + | ||
1237 | +/* architecture dependent code */ | ||
1238 | +#define CONFIG_SYS_USR_EXCEP /* user exception */ | ||
1239 | +#define CONFIG_SYS_HZ 1000 | ||
1240 | + | ||
1241 | +#define CONFIG_ENV_OVERWRITE /* Allow to overwrite the u-boot environment variables */ | ||
1242 | +#define CONFIG_IPADDR 192.168.10.90 | ||
1243 | +#define CONFIG_SERVERIP 192.168.10.101 | ||
1244 | +#define CONFIG_ETHADDR 00:0a:35:00:92:d4 | ||
1245 | +#define CONFIG_BOOTP_SERVERIP | ||
1246 | + | ||
1247 | +#define CONFIG_CMDLINE_EDITING | ||
1248 | + | ||
1249 | +/* Use the HUSH parser */ | ||
1250 | +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " | ||
1251 | + | ||
1252 | +#define CONFIG_FIT 1 | ||
1253 | +#define CONFIG_OF_LIBFDT 1 | ||
1254 | + | ||
1255 | +#if defined(CONFIG_XILINX_LL_TEMAC) | ||
1256 | +# define CONFIG_MII 1 | ||
1257 | +# define CONFIG_CMD_MII 1 | ||
1258 | +# define CONFIG_PHY_GIGE 1 | ||
1259 | +# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN 1 | ||
1260 | +# define CONFIG_PHYLIB 1 | ||
1261 | +# define CONFIG_PHY_ATHEROS 1 | ||
1262 | +# define CONFIG_PHY_BROADCOM 1 | ||
1263 | +# define CONFIG_PHY_DAVICOM 1 | ||
1264 | +# define CONFIG_PHY_LXT 1 | ||
1265 | +# define CONFIG_PHY_MARVELL 1 | ||
1266 | +# define CONFIG_PHY_MICREL 1 | ||
1267 | +# define CONFIG_PHY_NATSEMI 1 | ||
1268 | +# define CONFIG_PHY_REALTEK 1 | ||
1269 | +# define CONFIG_PHY_VITESSE 1 | ||
1270 | +#else | ||
1271 | +# undef CONFIG_MII | ||
1272 | +# undef CONFIG_CMD_MII | ||
1273 | +# undef CONFIG_PHYLIB | ||
1274 | +#endif | ||
1275 | + | ||
1276 | +#endif /* __CONFIG_H */ | ||
1277 | diff --git a/include/configs/xilinx-ppc405.h b/include/configs/xilinx-ppc405.h | ||
1278 | deleted file mode 100644 | ||
1279 | index d335f1e..0000000 | ||
1280 | --- a/include/configs/xilinx-ppc405.h | ||
1281 | +++ /dev/null | ||
1282 | @@ -1,39 +0,0 @@ | ||
1283 | -/* | ||
1284 | - * | ||
1285 | - * (C) Copyright 2008 | ||
1286 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1287 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
1288 | - * | ||
1289 | - * (C) Copyright 2008 | ||
1290 | - * Georg Schardt <schardt@team-ctech.de> | ||
1291 | - * | ||
1292 | - * See file CREDITS for list of people who contributed to this | ||
1293 | - * project. | ||
1294 | - * | ||
1295 | - * This program is free software; you can redistribute it and/or | ||
1296 | - * modify it under the terms of the GNU General Public License as | ||
1297 | - * published by the Free Software Foundation; either version 2 of | ||
1298 | - * the License, or (at your option) any later version. | ||
1299 | - * | ||
1300 | - * This program is distributed in the hope that it will be useful, | ||
1301 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1302 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1303 | - * GNU General Public License for more details. | ||
1304 | - * | ||
1305 | - * You should have received a copy of the GNU General Public License | ||
1306 | - * along with this program; if not, write to the Free Software | ||
1307 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1308 | - * MA 02111-1307 USA | ||
1309 | - */ | ||
1310 | - | ||
1311 | -#ifndef __CONFIG_H | ||
1312 | -#define __CONFIG_H | ||
1313 | - | ||
1314 | -/* cpu parameter */ | ||
1315 | -#define CONFIG_405 1 | ||
1316 | -#define CONFIG_4xx 1 | ||
1317 | -#define CONFIG_XILINX_405 1 | ||
1318 | - | ||
1319 | -#include <configs/xilinx-ppc.h> | ||
1320 | - | ||
1321 | -#endif | ||
1322 | diff --git a/include/configs/xilinx-ppc440-generic.h b/include/configs/xilinx-ppc440-generic.h | ||
1323 | index fc0f932..78c0dec 100644 | ||
1324 | --- a/include/configs/xilinx-ppc440-generic.h | ||
1325 | +++ b/include/configs/xilinx-ppc440-generic.h | ||
1326 | @@ -1,49 +1,300 @@ | ||
1327 | /* | ||
1328 | - * (C) Copyright 2008 | ||
1329 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1330 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
1331 | - * This program is free software: you can redistribute it and/or modify | ||
1332 | - * it under the terms of the GNU General Public License as published by | ||
1333 | - * the Free Software Foundation, either version 2 of the License, or | ||
1334 | - * (at your option) any later version. | ||
1335 | - * | ||
1336 | - * This program is distributed in the hope that it will be useful, | ||
1337 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1338 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1339 | - * GNU General Public License for more details. | ||
1340 | - * You should have received a copy of the GNU General Public License | ||
1341 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1342 | -*/ | ||
1343 | + * (C) Copyright 2007-2010 Michal Simek | ||
1344 | + * | ||
1345 | + * Michal SIMEK <monstr@monstr.eu> | ||
1346 | + * | ||
1347 | + * See file CREDITS for list of people who contributed to this | ||
1348 | + * project. | ||
1349 | + * | ||
1350 | + * This program is free software; you can redistribute it and/or | ||
1351 | + * modify it under the terms of the GNU General Public License as | ||
1352 | + * published by the Free Software Foundation; either version 2 of | ||
1353 | + * the License, or (at your option) any later version. | ||
1354 | + * | ||
1355 | + * This program is distributed in the hope that it will be useful, | ||
1356 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1357 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1358 | + * GNU General Public License for more details. | ||
1359 | + * | ||
1360 | + * You should have received a copy of the GNU General Public License | ||
1361 | + * along with this program; if not, write to the Free Software | ||
1362 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1363 | + * MA 02111-1307 USA | ||
1364 | + */ | ||
1365 | |||
1366 | #ifndef __CONFIG_H | ||
1367 | #define __CONFIG_H | ||
1368 | |||
1369 | -/*CPU*/ | ||
1370 | -#define CONFIG_440 1 | ||
1371 | -#define CONFIG_XILINX_PPC440_GENERIC 1 | ||
1372 | #include "../board/xilinx/ppc440-generic/xparameters.h" | ||
1373 | |||
1374 | -/*Mem Map*/ | ||
1375 | -#define CONFIG_SYS_SDRAM_SIZE_MB 256 | ||
1376 | +/* cpu parameter */ | ||
1377 | +#define CONFIG_4xx 1 | ||
1378 | +#define CONFIG_440 1 | ||
1379 | +#define CONFIG_XILINX_440 1 | ||
1380 | +#define CONFIG_XILINX_440_GENERIC 1 | ||
1381 | + | ||
1382 | +/* Gross XPAR_ hackery */ | ||
1383 | +#define XPAR_INTC_0_BASEADDR XILINX_INTC_BASEADDR | ||
1384 | +#define XPAR_INTC_MAX_NUM_INTR_INPUTS XILINX_INTC_NUM_INTR_INPUTS | ||
1385 | + | ||
1386 | +/* PPC-specific memory layout */ | ||
1387 | +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE | ||
1388 | +#define CONFIG_SYS_MONITOR_LEN (256 * 1024) | ||
1389 | +#define CONFIG_SYS_MALLOC_LEN (128 * 1024) | ||
1390 | + | ||
1391 | +/*Stack*/ | ||
1392 | +#define CONFIG_SYS_INIT_RAM_ADDR 0x800000/* Initial RAM address */ | ||
1393 | +#define CONFIG_SYS_INIT_RAM_END 0x2000 /* End of used area in RAM */ | ||
1394 | +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END \ | ||
1395 | + - GENERATED_GBL_DATA_SIZE) | ||
1396 | +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET | ||
1397 | + | ||
1398 | +/*Speed*/ | ||
1399 | +#define CONFIG_SYS_CLK_FREQ XILINX_CLOCK_FREQ | ||
1400 | + | ||
1401 | +/* Common PPC-specific settings */ | ||
1402 | +#define CONFIG_SYS_MEMTEST_START 0x00400000 | ||
1403 | + /* memtest works on */ | ||
1404 | +#define CONFIG_SYS_MEMTEST_END 0x00C00000 | ||
1405 | + /* 4 ... 12 MB in DRAM */ | ||
1406 | +#define CONFIG_SYS_EXTBDINFO 1 | ||
1407 | + /* Extended board_into (bd_t) */ | ||
1408 | +#define CONFIG_SYS_HZ 1000 | ||
1409 | + /* decrementer freq: 1 ms ticks */ | ||
1410 | + | ||
1411 | +#define CONFIG_SYS_BOOTMAPSZ (16 << 20) | ||
1412 | + /* Initial Memory map for Linux */ | ||
1413 | + | ||
1414 | +/* The following table includes the supported baudrates */ | ||
1415 | +#define CONFIG_SYS_BAUDRATE_TABLE \ | ||
1416 | + {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400} | ||
1417 | + | ||
1418 | +/* use serial multi for all serial devices */ | ||
1419 | +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 | ||
1420 | + | ||
1421 | +#ifdef XILINX_UARTLITE_BASEADDR | ||
1422 | +# define CONFIG_XILINX_UARTLITE | ||
1423 | +# if defined(XILINX_UARTLITE_BAUDRATE) | ||
1424 | +# define CONFIG_BAUDRATE XILINX_UARTLITE_BAUDRATE | ||
1425 | +# endif | ||
1426 | +#endif | ||
1427 | + | ||
1428 | +#if XILINX_UART16550_BASEADDR | ||
1429 | +# define CONFIG_SYS_NS16550 1 | ||
1430 | +# define CONFIG_SYS_NS16550_SERIAL | ||
1431 | +# define CONFIG_SYS_NS16550_COM1 ((XILINX_UART16550_BASEADDR & ~0xF) + 0x1000) | ||
1432 | +# define CONFIG_SYS_NS16550_CLK XILINX_UART16550_CLOCK_HZ | ||
1433 | + | ||
1434 | +# if defined(__MICROBLAZEEL__) | ||
1435 | +# define CONFIG_SYS_NS16550_REG_SIZE -4 | ||
1436 | +# else | ||
1437 | +# define CONFIG_SYS_NS16550_REG_SIZE 4 | ||
1438 | +# endif | ||
1439 | + | ||
1440 | +/* CONS_INDEX for system with uartlite only mustn't define CONFIG_CONS_INDEX | ||
1441 | + * u-boot BSP generates CONFIG_CONS_INDEX for system with several uart16550 */ | ||
1442 | +# if !defined(CONFIG_CONS_INDEX) | ||
1443 | +# define CONFIG_CONS_INDEX 1 | ||
1444 | +# endif | ||
1445 | +#endif | ||
1446 | + | ||
1447 | +#if !defined(CONFIG_BAUDRATE) | ||
1448 | + #define CONFIG_BAUDRATE 115200 | ||
1449 | +#endif | ||
1450 | + | ||
1451 | +#undef CONFIG_SYS_ENET | ||
1452 | +#if defined(XILINX_EMACLITE_BASEADDR) | ||
1453 | + #define CONFIG_XILINX_EMACLITE 1 | ||
1454 | + #define CONFIG_SYS_ENET | ||
1455 | +#endif | ||
1456 | +#if defined(XILINX_LLTEMAC_BASEADDR) | ||
1457 | + #define CONFIG_XILINX_LL_TEMAC 1 | ||
1458 | + #define CONFIG_SYS_ENET | ||
1459 | +#endif | ||
1460 | + | ||
1461 | +#undef ET_DEBUG | ||
1462 | + | ||
1463 | + | ||
1464 | +/* interrupt controller */ | ||
1465 | +#ifdef XILINX_INTC_BASEADDR | ||
1466 | + #define CONFIG_SYS_INTC_0 1 | ||
1467 | + #define CONFIG_SYS_INTC_0_ADDR XILINX_INTC_BASEADDR | ||
1468 | + #define CONFIG_SYS_INTC_0_NUM XILINX_INTC_NUM_INTR_INPUTS | ||
1469 | +#endif | ||
1470 | + | ||
1471 | +/* timer */ | ||
1472 | +#ifdef XILINX_TIMER_BASEADDR | ||
1473 | + #if (XILINX_TIMER_IRQ != -1) | ||
1474 | + #define CONFIG_SYS_TIMER_0 1 | ||
1475 | + #define CONFIG_SYS_TIMER_0_ADDR XILINX_TIMER_BASEADDR | ||
1476 | + #define CONFIG_SYS_TIMER_0_IRQ XILINX_TIMER_IRQ | ||
1477 | + #define FREQUENCE XILINX_CLOCK_FREQ | ||
1478 | + #define CONFIG_SYS_TIMER_0_PRELOAD ( FREQUENCE/1000 ) | ||
1479 | + #endif | ||
1480 | +#else | ||
1481 | +# error Please setup TIMER in BSP | ||
1482 | +#endif | ||
1483 | + | ||
1484 | +/* | ||
1485 | + * memory layout - Example | ||
1486 | + * TEXT_BASE = 0x1200_0000; | ||
1487 | + * CONFIG_SYS_SRAM_BASE = 0x1000_0000; | ||
1488 | + * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; | ||
1489 | + * | ||
1490 | + * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000 | ||
1491 | + * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - 0x40000 = 0x13FB_F000 | ||
1492 | + * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - 0x40000 = 0x13F7_F000 | ||
1493 | + * | ||
1494 | + * 0x1000_0000 CONFIG_SYS_SDRAM_BASE | ||
1495 | + * FREE | ||
1496 | + * 0x1200_0000 TEXT_BASE | ||
1497 | + * U-BOOT code | ||
1498 | + * 0x1202_0000 | ||
1499 | + * FREE | ||
1500 | + * | ||
1501 | + * STACK | ||
1502 | + * 0x13F7_F000 CONFIG_SYS_MALLOC_BASE | ||
1503 | + * MALLOC_AREA 256kB Alloc | ||
1504 | + * 0x11FB_F000 CONFIG_SYS_MONITOR_BASE | ||
1505 | + * MONITOR_CODE 256kB Env | ||
1506 | + * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET | ||
1507 | + * GLOBAL_DATA 4kB bd, gd | ||
1508 | + * 0x1400_0000 CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE | ||
1509 | + */ | ||
1510 | + | ||
1511 | +/* ddr sdram - main memory */ | ||
1512 | +#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START | ||
1513 | +#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE | ||
1514 | + | ||
1515 | +#if defined(XILINX_FLASH_START) /* Parallel Flash */ | ||
1516 | + #define FLASH | ||
1517 | + #define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START | ||
1518 | + #define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE | ||
1519 | + #define CONFIG_SYS_FLASH_CFI 1 | ||
1520 | + #define CONFIG_FLASH_CFI_DRIVER 1 | ||
1521 | + #define CONFIG_SYS_FLASH_EMPTY_INFO 1 /* ?empty sector */ | ||
1522 | + #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ | ||
1523 | + #define CONFIG_SYS_MAX_FLASH_SECT 2048 /* max number of sectors on one chip */ | ||
1524 | + | ||
1525 | + /* Assume env is in flash, this may be undone lower down */ | ||
1526 | + #define CONFIG_ENV_IS_IN_FLASH 1 | ||
1527 | + #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K(one sector) for env */ | ||
1528 | + | ||
1529 | + #define CONFIG_SYS_FLASH_PROTECTION | ||
1530 | + | ||
1531 | + #define CONFIG_ENV_ADDR XILINX_FLASH_START | ||
1532 | + #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE | ||
1533 | +#else /* No flash memory at all */ | ||
1534 | + /* ENV in RAM */ | ||
1535 | + #define RAMENV | ||
1536 | + #define CONFIG_SYS_NO_FLASH 1 | ||
1537 | + | ||
1538 | + #define CONFIG_ENV_IS_NOWHERE 1 | ||
1539 | + #undef CONFIG_ENV_IS_IN_FLASH | ||
1540 | + #undef CONFIG_ENV_IS_IN_SPI_FLASH | ||
1541 | + #define CONFIG_ENV_SIZE 0x1000 | ||
1542 | + #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE) | ||
1543 | + #define CONFIG_SYS_FLASH_PROTECTION /* hardware flash protection */ | ||
1544 | +#endif | ||
1545 | + | ||
1546 | +/* | ||
1547 | + * BOOTP options | ||
1548 | + */ | ||
1549 | +#define CONFIG_BOOTP_BOOTFILESIZE | ||
1550 | +#define CONFIG_BOOTP_BOOTPATH | ||
1551 | +#define CONFIG_BOOTP_GATEWAY | ||
1552 | +#define CONFIG_BOOTP_HOSTNAME | ||
1553 | + | ||
1554 | +/* | ||
1555 | + * Command line configuration. | ||
1556 | + */ | ||
1557 | +#include <config_cmd_default.h> | ||
1558 | + | ||
1559 | +#define CONFIG_CMD_ASKENV | ||
1560 | +/* FIXME: hack for zynq */ | ||
1561 | +#define CONFIG_CMD_IRQ | ||
1562 | +#define CONFIG_CMD_ECHO | ||
1563 | + | ||
1564 | +#undef CONFIG_CMD_NFS | ||
1565 | +#undef CONFIG_CMD_JFFS2 | ||
1566 | +#ifndef CONFIG_SYS_ENET | ||
1567 | + #undef CONFIG_CMD_NET | ||
1568 | + #undef CONFIG_NET_MULTI | ||
1569 | +#else | ||
1570 | + #define CONFIG_CMD_PING | ||
1571 | + #define CONFIG_NET_MULTI | ||
1572 | +#endif | ||
1573 | + | ||
1574 | +#if defined(FLASH) | ||
1575 | + #define CONFIG_CMD_FLASH | ||
1576 | + #define CONFIG_CMD_IMLS | ||
1577 | +#else | ||
1578 | + #undef CONFIG_CMD_IMLS | ||
1579 | + #undef CONFIG_CMD_FLASH | ||
1580 | + #undef CONFIG_CMD_SAVEENV | ||
1581 | + #undef CONFIG_CMD_SAVES | ||
1582 | +#endif | ||
1583 | + | ||
1584 | +#if !defined(RAMENV) | ||
1585 | + #define CONFIG_CMD_SAVEENV | ||
1586 | + #define CONFIG_CMD_SAVES | ||
1587 | +#endif | ||
1588 | + | ||
1589 | +/* Miscellaneous configurable options */ | ||
1590 | +#define CONFIG_SYS_PROMPT "U-Boot> " | ||
1591 | +#define CONFIG_SYS_CBSIZE 256/* Console I/O Buffer Size */ | ||
1592 | +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE +\ | ||
1593 | + sizeof(CONFIG_SYS_PROMPT) + 16) | ||
1594 | +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | ||
1595 | + /* Boot Argument Buffer Size */ | ||
1596 | +#define CONFIG_SYS_MAXARGS 15 /* max number of command args */ | ||
1597 | +#define CONFIG_SYS_LONGHELP | ||
1598 | +#define CONFIG_SYS_LOAD_ADDR XILINX_RAM_START /* default load address */ | ||
1599 | + | ||
1600 | +#define CONFIG_BOOTDELAY 4 | ||
1601 | +/* Don't define BOOTARGS, we get it from the DTB chosen fragment */ | ||
1602 | +#undef CONFIG_BOOTARGS | ||
1603 | +#define CONFIG_HOSTNAME XILINX_BOARD_NAME | ||
1604 | + | ||
1605 | +#define CONFIG_BOOTCOMMAND "" | ||
1606 | + | ||
1607 | +/* architecture dependent code */ | ||
1608 | +#define CONFIG_SYS_USR_EXCEP /* user exception */ | ||
1609 | +#define CONFIG_SYS_HZ 1000 | ||
1610 | + | ||
1611 | +#define CONFIG_ENV_OVERWRITE /* Allow to overwrite the u-boot environment variables */ | ||
1612 | +#define CONFIG_IPADDR 192.168.10.90 | ||
1613 | +#define CONFIG_SERVERIP 192.168.10.101 | ||
1614 | +#define CONFIG_ETHADDR 00:0a:35:00:92:d4 | ||
1615 | +#define CONFIG_BOOTP_SERVERIP | ||
1616 | |||
1617 | -/*Env*/ | ||
1618 | -#define CONFIG_ENV_IS_IN_FLASH 1 | ||
1619 | -#define CONFIG_ENV_SIZE 0x20000 | ||
1620 | -#define CONFIG_ENV_SECT_SIZE 0x20000 | ||
1621 | -#define CONFIG_ENV_OFFSET 0x340000 | ||
1622 | -#define CONFIG_ENV_ADDR (XPAR_FLASH_MEM0_BASEADDR+CONFIG_ENV_OFFSET) | ||
1623 | +#define CONFIG_CMDLINE_EDITING | ||
1624 | |||
1625 | -/*Misc*/ | ||
1626 | -#define CONFIG_SYS_PROMPT "board:/# " /* Monitor Command Prompt */ | ||
1627 | -#define CONFIG_PREBOOT "echo U-Boot is up and runnining;" | ||
1628 | +/* Use the HUSH parser */ | ||
1629 | +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " | ||
1630 | |||
1631 | -/*Flash*/ | ||
1632 | -#define CONFIG_SYS_FLASH_SIZE (32*1024*1024) | ||
1633 | -#define CONFIG_SYS_MAX_FLASH_SECT 259 | ||
1634 | -#define MTDIDS_DEFAULT "nor0=ml507-flash" | ||
1635 | -#define MTDPARTS_DEFAULT "mtdparts=ml507-flash:-(user)" | ||
1636 | +#define CONFIG_FIT 1 | ||
1637 | +#define CONFIG_OF_LIBFDT 1 | ||
1638 | |||
1639 | -/*Generic Configs*/ | ||
1640 | -#include <configs/xilinx-ppc440.h> | ||
1641 | +#if defined(CONFIG_XILINX_LL_TEMAC) | ||
1642 | +# define CONFIG_MII 1 | ||
1643 | +# define CONFIG_CMD_MII 1 | ||
1644 | +# define CONFIG_PHY_GIGE 1 | ||
1645 | +# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN 1 | ||
1646 | +# define CONFIG_PHYLIB 1 | ||
1647 | +# define CONFIG_PHY_ATHEROS 1 | ||
1648 | +# define CONFIG_PHY_BROADCOM 1 | ||
1649 | +# define CONFIG_PHY_DAVICOM 1 | ||
1650 | +# define CONFIG_PHY_LXT 1 | ||
1651 | +# define CONFIG_PHY_MARVELL 1 | ||
1652 | +# define CONFIG_PHY_MICREL 1 | ||
1653 | +# define CONFIG_PHY_NATSEMI 1 | ||
1654 | +# define CONFIG_PHY_REALTEK 1 | ||
1655 | +# define CONFIG_PHY_VITESSE 1 | ||
1656 | +#else | ||
1657 | +# undef CONFIG_MII | ||
1658 | +# undef CONFIG_CMD_MII | ||
1659 | +# undef CONFIG_PHYLIB | ||
1660 | +#endif | ||
1661 | |||
1662 | -#endif /* __CONFIG_H */ | ||
1663 | +#endif /* __CONFIG_H */ | ||
1664 | diff --git a/include/configs/xilinx-ppc440.h b/include/configs/xilinx-ppc440.h | ||
1665 | deleted file mode 100644 | ||
1666 | index 6e938dc..0000000 | ||
1667 | --- a/include/configs/xilinx-ppc440.h | ||
1668 | +++ /dev/null | ||
1669 | @@ -1,28 +0,0 @@ | ||
1670 | -/* | ||
1671 | - * (C) Copyright 2008 | ||
1672 | - * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda@uam.es | ||
1673 | - * This work has been supported by: QTechnology http://qtec.com/ | ||
1674 | - * This program is free software: you can redistribute it and/or modify | ||
1675 | - * it under the terms of the GNU General Public License as published by | ||
1676 | - * the Free Software Foundation, either version 2 of the License, or | ||
1677 | - * (at your option) any later version. | ||
1678 | - * | ||
1679 | - * This program is distributed in the hope that it will be useful, | ||
1680 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1681 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1682 | - * GNU General Public License for more details. | ||
1683 | - * You should have received a copy of the GNU General Public License | ||
1684 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1685 | -*/ | ||
1686 | - | ||
1687 | -#ifndef __CONFIG_GEN_H | ||
1688 | -#define __CONFIG_GEN_H | ||
1689 | - | ||
1690 | -/*CPU*/ | ||
1691 | -#define CONFIG_4xx 1 | ||
1692 | -#define CONFIG_440 1 | ||
1693 | -#define CONFIG_XILINX_440 1 | ||
1694 | - | ||
1695 | -#include <configs/xilinx-ppc.h> | ||
1696 | - | ||
1697 | -#endif /* __CONFIG_H */ | ||
1698 | diff --git a/include/configs/zynq_afx.h b/include/configs/zynq_afx.h | ||
1699 | new file mode 100644 | ||
1700 | index 0000000..7339fbc | ||
1701 | --- /dev/null | ||
1702 | +++ b/include/configs/zynq_afx.h | ||
1703 | @@ -0,0 +1,36 @@ | ||
1704 | +/* | ||
1705 | + * (C) Copyright 2012 Xilinx | ||
1706 | + * | ||
1707 | + * Configuration settings for the Xilinx Zynq AFX board. | ||
1708 | + * See zynq_common.h for Zynq common configs | ||
1709 | + * | ||
1710 | + * This program is free software; you can redistribute it and/or | ||
1711 | + * modify it under the terms of the GNU General Public License as | ||
1712 | + * published by the Free Software Foundation; either version 2 of | ||
1713 | + * the License, or (at your option) any later version. | ||
1714 | + * | ||
1715 | + * You should have received a copy of the GNU General Public License | ||
1716 | + * along with this program; if not, write to the Free Software | ||
1717 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1718 | + * MA 02111-1307 USA | ||
1719 | + */ | ||
1720 | + | ||
1721 | +#ifndef __CONFIG_ZYNQ_AFX_H | ||
1722 | +#define __CONFIG_ZYNQ_AFX_H | ||
1723 | + | ||
1724 | +#define PHYS_SDRAM_1_SIZE (128 * 1024 * 1024) | ||
1725 | + | ||
1726 | +#define CONFIG_ZYNQ_SERIAL_UART1 | ||
1727 | + | ||
1728 | +#define CONFIG_SYS_NO_FLASH | ||
1729 | +#if defined(CONFIG_AFX_NOR) | ||
1730 | +# undef CONFIG_SYS_NO_FLASH | ||
1731 | +#elif defined(CONFIG_AFX_QSPI) | ||
1732 | +# define CONFIG_ZYNQ_SPI | ||
1733 | +#elif defined(CONFIG_AFX_NAND) | ||
1734 | +# define CONFIG_NAND_ZYNQ | ||
1735 | +#endif | ||
1736 | + | ||
1737 | +#include <configs/zynq_common.h> | ||
1738 | + | ||
1739 | +#endif /* __CONFIG_ZYNQ_AFX_H */ | ||
1740 | diff --git a/include/configs/zynq_common.h b/include/configs/zynq_common.h | ||
1741 | new file mode 100644 | ||
1742 | index 0000000..28948fb | ||
1743 | --- /dev/null | ||
1744 | +++ b/include/configs/zynq_common.h | ||
1745 | @@ -0,0 +1,300 @@ | ||
1746 | +/* | ||
1747 | + * (C) Copyright 2012 Xilinx | ||
1748 | + * | ||
1749 | + * Xilinx Zynq common configuration settings | ||
1750 | + * | ||
1751 | + * This program is free software; you can redistribute it and/or | ||
1752 | + * modify it under the terms of the GNU General Public License as | ||
1753 | + * published by the Free Software Foundation; either version 2 of | ||
1754 | + * the License, or (at your option) any later version. | ||
1755 | + * | ||
1756 | + * You should have received a copy of the GNU General Public License | ||
1757 | + * along with this program; if not, write to the Free Software | ||
1758 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
1759 | + * MA 02111-1307 USA | ||
1760 | + */ | ||
1761 | + | ||
1762 | +#ifndef __CONFIG_ZYNQ_COMMON_H | ||
1763 | +#define __CONFIG_ZYNQ_COMMON_H | ||
1764 | + | ||
1765 | +/* High Level Configuration Options */ | ||
1766 | +#define CONFIG_ARMV7 /* CPU */ | ||
1767 | +#define CONFIG_ZYNQ /* SoC */ | ||
1768 | + | ||
1769 | +/* Default environment */ | ||
1770 | +#define CONFIG_IPADDR 10.10.70.102 | ||
1771 | +#define CONFIG_SERVERIP 10.10.70.101 | ||
1772 | + | ||
1773 | +#define CONFIG_SYS_SDRAM_BASE 0 | ||
1774 | +#define CONFIG_SYS_SDRAM_SIZE PHYS_SDRAM_1_SIZE | ||
1775 | + | ||
1776 | +/* Total Size of Environment Sector */ | ||
1777 | +#define CONFIG_ENV_SIZE (128 << 10) | ||
1778 | + | ||
1779 | +/* allow to overwrite serial and ethaddr */ | ||
1780 | +#define CONFIG_ENV_OVERWRITE | ||
1781 | + | ||
1782 | +/* Size of malloc() pool */ | ||
1783 | +#define CONFIG_SYS_MALLOC_LEN 0x400000 | ||
1784 | + | ||
1785 | +/* Serial drivers */ | ||
1786 | +#define CONFIG_BAUDRATE 115200 | ||
1787 | +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 38400, 115200 } | ||
1788 | + | ||
1789 | +/* Zynq serial driver */ | ||
1790 | +#ifdef CONFIG_ZYNQ_SERIAL_UART0 | ||
1791 | +# define CONFIG_ZYNQ_SERIAL_BASEADDR0 0xE0000000 | ||
1792 | +# define CONFIG_ZYNQ_SERIAL_BAUDRATE0 CONFIG_BAUDRATE | ||
1793 | +# define CONFIG_ZYNQ_SERIAL_CLOCK0 50000000 | ||
1794 | +#endif | ||
1795 | + | ||
1796 | +#ifdef CONFIG_ZYNQ_SERIAL_UART1 | ||
1797 | +# define CONFIG_ZYNQ_SERIAL_BASEADDR1 0xE0001000 | ||
1798 | +# define CONFIG_ZYNQ_SERIAL_BAUDRATE1 CONFIG_BAUDRATE | ||
1799 | +# define CONFIG_ZYNQ_SERIAL_CLOCK1 50000000 | ||
1800 | +#endif | ||
1801 | + | ||
1802 | +#if defined(CONFIG_ZYNQ_SERIAL_UART0) || defined(CONFIG_ZYNQ_SERIAL_UART1) | ||
1803 | +#define CONFIG_ZYNQ_SERIAL | ||
1804 | +#endif | ||
1805 | + | ||
1806 | +/* Ethernet driver */ | ||
1807 | +#ifdef CONFIG_ZYNQ_GEM0 | ||
1808 | +# define CONFIG_ZYNQ_GEM_BASEADDR0 0xE000B000 | ||
1809 | +#endif | ||
1810 | + | ||
1811 | +#ifdef CONFIG_ZYNQ_GEM1 | ||
1812 | +# define CONFIG_ZYNQ_GEM_BASEADDR1 0xE000C000 | ||
1813 | +#endif | ||
1814 | + | ||
1815 | +#if defined(CONFIG_ZYNQ_GEM0) || defined(CONFIG_ZYNQ_GEM1) | ||
1816 | +# define CONFIG_NET_MULTI | ||
1817 | +# define CONFIG_ZYNQ_GEM | ||
1818 | +# define CONFIG_MII | ||
1819 | +# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN | ||
1820 | +# define CONFIG_PHYLIB | ||
1821 | +# define CONFIG_PHY_MARVELL | ||
1822 | +# define CONFIG_SYS_ENET | ||
1823 | +#endif | ||
1824 | + | ||
1825 | +/* SCU timer address is hardcoded */ | ||
1826 | +#define CONFIG_SCUTIMER_BASEADDR 0xF8F00600 | ||
1827 | +#ifndef CONFIG_CPU_FREQ_HZ | ||
1828 | +#define CONFIG_CPU_FREQ_HZ 800000000 | ||
1829 | +#endif | ||
1830 | +#define CONFIG_SYS_HZ 1000 | ||
1831 | + | ||
1832 | +/* Miscellaneous configurable options */ | ||
1833 | +#define CONFIG_SYS_PROMPT "zynq-uboot> " | ||
1834 | +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ | ||
1835 | +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " | ||
1836 | + | ||
1837 | +#define CONFIG_CMDLINE_EDITING | ||
1838 | +#define CONFIG_AUTO_COMPLETE | ||
1839 | +#define CONFIG_SYS_LONGHELP | ||
1840 | +#define CONFIG_BOARD_LATE_INIT | ||
1841 | +#define CONFIG_SYS_MAXARGS 16 | ||
1842 | +#define CONFIG_SYS_CBSIZE 2048 | ||
1843 | +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ | ||
1844 | + sizeof(CONFIG_SYS_PROMPT) + 16) | ||
1845 | + | ||
1846 | +/* Open Firmware flat tree */ | ||
1847 | +#define CONFIG_OF_LIBFDT | ||
1848 | + | ||
1849 | +#include <config_cmd_default.h> | ||
1850 | + | ||
1851 | +#ifdef CONFIG_SYS_ENET | ||
1852 | +# define CONFIG_CMD_PING | ||
1853 | +# define CONFIG_CMD_MII | ||
1854 | +#else | ||
1855 | +# undef CONFIG_CMD_NET | ||
1856 | +# undef CONFIG_CMD_NFS | ||
1857 | +#endif | ||
1858 | + | ||
1859 | +/* NOR */ | ||
1860 | +#ifndef CONFIG_SYS_NO_FLASH | ||
1861 | +# define CONFIG_SYS_FLASH_BASE 0xE2000000 | ||
1862 | +# define CONFIG_SYS_FLASH_SIZE (16 * 1024 * 1024) | ||
1863 | +# define CONFIG_SYS_MAX_FLASH_BANKS 1 | ||
1864 | +/* max number of sectors/blocks on one chip */ | ||
1865 | +# define CONFIG_SYS_MAX_FLASH_SECT 512 | ||
1866 | +# define CONFIG_SYS_FLASH_ERASE_TOUT 1000 | ||
1867 | +# define CONFIG_SYS_FLASH_WRITE_TOUT 5000 | ||
1868 | +# define CONFIG_FLASH_SHOW_PROGRESS 10 | ||
1869 | +# define CONFIG_SYS_FLASH_CFI | ||
1870 | +# undef CONFIG_SYS_FLASH_EMPTY_INFO | ||
1871 | +# define CONFIG_FLASH_CFI_DRIVER | ||
1872 | +# undef CONFIG_SYS_FLASH_PROTECTION /* don't use hardware protection */ | ||
1873 | +/* use buffered writes (20x faster) */ | ||
1874 | +# define CONFIG_SYS_FLASH_USE_BUFFER_WRITE | ||
1875 | +#endif | ||
1876 | + | ||
1877 | +/* QSPI */ | ||
1878 | +#ifdef CONFIG_ZYNQ_SPI | ||
1879 | +# define CONFIG_SF_DEFAULT_SPEED 30000000 | ||
1880 | +# define CONFIG_SPI_FLASH | ||
1881 | +# define CONFIG_SPI_FLASH_SPANSION | ||
1882 | +# define CONFIG_SPI_FLASH_STMICRO | ||
1883 | +# define CONFIG_SPI_FLASH_WINBOND | ||
1884 | +# define CONFIG_CMD_SPI | ||
1885 | +# define CONFIG_CMD_SF | ||
1886 | +#endif | ||
1887 | + | ||
1888 | +/* MMC */ | ||
1889 | +#ifdef CONFIG_MMC | ||
1890 | +# define CONFIG_GENERIC_MMC | ||
1891 | +# define CONFIG_SDHCI | ||
1892 | +# define CONFIG_ZYNQ_SDHCI | ||
1893 | +# define CONFIG_CMD_MMC | ||
1894 | +# define CONFIG_CMD_FAT | ||
1895 | +# define CONFIG_SUPPORT_VFAT | ||
1896 | +# define CONFIG_CMD_EXT2 | ||
1897 | +# define CONFIG_DOS_PARTITION | ||
1898 | +#endif | ||
1899 | + | ||
1900 | +/* NAND */ | ||
1901 | +#ifdef CONFIG_NAND_ZYNQ | ||
1902 | +# define CONFIG_CMD_NAND | ||
1903 | +# define CONFIG_CMD_NAND_LOCK_UNLOCK | ||
1904 | +# define CONFIG_SYS_MAX_NAND_DEVICE 1 | ||
1905 | +# define CONFIG_SYS_NAND_BASE XPSS_NAND_BASEADDR | ||
1906 | +# define CONFIG_SYS_NAND_ONFI_DETECTION | ||
1907 | +# define CONFIG_MTD_DEVICE | ||
1908 | +#endif | ||
1909 | + | ||
1910 | +/* I2C */ | ||
1911 | +#ifdef CONFIG_ZYNQ_I2C | ||
1912 | +# define CONFIG_CMD_I2C | ||
1913 | +# define CONFIG_ZYNQ_I2C_CTLR_0 | ||
1914 | +# define CONFIG_HARD_I2C 1 | ||
1915 | +# define CONFIG_SYS_I2C_SPEED 100000 | ||
1916 | +# define CONFIG_SYS_I2C_SLAVE 1 | ||
1917 | +#endif | ||
1918 | + | ||
1919 | +/* EEPROM */ | ||
1920 | +#ifdef CONFIG_ZYNQ_EEPROM | ||
1921 | +# define CONFIG_CMD_EEPROM | ||
1922 | +# define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 | ||
1923 | +# define CONFIG_SYS_I2C_EEPROM_ADDR 0x54 | ||
1924 | +# define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4 | ||
1925 | +# define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 | ||
1926 | +# define CONFIG_SYS_EEPROM_SIZE 1024 /* Bytes */ | ||
1927 | +#endif | ||
1928 | + | ||
1929 | +#ifndef CONFIG_ENV_IS_NOWHERE | ||
1930 | +# ifndef CONFIG_SYS_NO_FLASH | ||
1931 | +/* Environment in NOR flash */ | ||
1932 | +# define CONFIG_ENV_IS_IN_FLASH | ||
1933 | +# elif defined(CONFIG_ZYNQ_SPI) | ||
1934 | +/* Environment in Serial Flash */ | ||
1935 | +# define CONFIG_ENV_IS_IN_SPI_FLASH | ||
1936 | +# elif defined(CONFIG_NAND_ZYNQ) | ||
1937 | +/* Environment in NAND flash */ | ||
1938 | +# define CONFIG_ENV_IS_IN_NAND | ||
1939 | +# elif defined(CONFIG_SYS_NO_FLASH) | ||
1940 | +# define CONFIG_ENV_IS_NOWHERE | ||
1941 | +# endif | ||
1942 | + | ||
1943 | +# define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE | ||
1944 | +# define CONFIG_ENV_OFFSET 0xE0000 | ||
1945 | +# define CONFIG_CMD_SAVEENV /* Command to save ENV to Flash */ | ||
1946 | +#endif | ||
1947 | + | ||
1948 | +/* For development/debugging */ | ||
1949 | +#ifdef DEBUG | ||
1950 | +# define CONFIG_CMD_REGINFO | ||
1951 | +# define CONFIG_PANIC_HANG | ||
1952 | +#endif | ||
1953 | + | ||
1954 | +/* Default environment */ | ||
1955 | +#define CONFIG_EXTRA_ENV_SETTINGS \ | ||
1956 | + "ethaddr=00:0a:35:00:01:22\0" \ | ||
1957 | + "kernel_image=uImage\0" \ | ||
1958 | + "ramdisk_image=uramdisk.image.gz\0" \ | ||
1959 | + "devicetree_image=devicetree.dtb\0" \ | ||
1960 | + "bitstream_image=system.bit.bin\0" \ | ||
1961 | + "loadbit_addr=0x100000\0" \ | ||
1962 | + "kernel_size=0x500000\0" \ | ||
1963 | + "devicetree_size=0x20000\0" \ | ||
1964 | + "ramdisk_size=0x5E0000\0" \ | ||
1965 | + "fdt_high=0x20000000\0" \ | ||
1966 | + "initrd_high=0x20000000\0" \ | ||
1967 | + "mmc_loadbit_fat=echo Loading bitstream from SD/MMC/eMMC to RAM.. && " \ | ||
1968 | + "mmcinfo && " \ | ||
1969 | + "fatload mmc 0 ${loadbit_addr} ${bitstream_image} && " \ | ||
1970 | + "fpga load 0 ${loadbit_addr} ${filesize}\0" \ | ||
1971 | + "norboot=echo Copying Linux from NOR flash to RAM... && " \ | ||
1972 | + "cp 0xE2100000 0x3000000 ${kernel_size} && " \ | ||
1973 | + "cp 0xE2600000 0x2A00000 ${devicetree_size} && " \ | ||
1974 | + "echo Copying ramdisk... && " \ | ||
1975 | + "cp 0xE2620000 0x2000000 ${ramdisk_size} && " \ | ||
1976 | + "bootm 0x3000000 0x2000000 0x2A00000\0" \ | ||
1977 | + "qspiboot=echo Copying Linux from QSPI flash to RAM... && " \ | ||
1978 | + "sf probe 0 0 0 && " \ | ||
1979 | + "sf read 0x3000000 0x100000 ${kernel_size} && " \ | ||
1980 | + "sf read 0x2A00000 0x600000 ${devicetree_size} && " \ | ||
1981 | + "echo Copying ramdisk... && " \ | ||
1982 | + "sf read 0x2000000 0x620000 ${ramdisk_size} && " \ | ||
1983 | + "bootm 0x3000000 0x2000000 0x2A00000\0" \ | ||
1984 | + "sdboot=echo Copying Linux from SD to RAM... && " \ | ||
1985 | + "mmcinfo && " \ | ||
1986 | + "fatload mmc 0 0x3000000 ${kernel_image} && " \ | ||
1987 | + "fatload mmc 0 0x2A00000 ${devicetree_image} && " \ | ||
1988 | + "fatload mmc 0 0x2000000 ${ramdisk_image} && " \ | ||
1989 | + "bootm 0x3000000 0x2000000 0x2A00000\0" \ | ||
1990 | + "nandboot=echo Copying Linux from NAND flash to RAM... && " \ | ||
1991 | + "nand read 0x3000000 0x100000 ${kernel_size} && " \ | ||
1992 | + "nand read 0x2A00000 0x600000 ${devicetree_size} && " \ | ||
1993 | + "echo Copying ramdisk... && " \ | ||
1994 | + "nand read 0x2000000 0x620000 ${ramdisk_size} && " \ | ||
1995 | + "bootm 0x3000000 0x2000000 0x2A00000\0" \ | ||
1996 | + "jtagboot=echo TFTPing Linux to RAM... && " \ | ||
1997 | + "tftp 0x3000000 ${kernel_image} && " \ | ||
1998 | + "tftp 0x2A00000 ${devicetree_image} && " \ | ||
1999 | + "tftp 0x2000000 ${ramdisk_image} && " \ | ||
2000 | + "bootm 0x3000000 0x2000000 0x2A00000\0" | ||
2001 | + | ||
2002 | +/* default boot is according to the bootmode switch settings */ | ||
2003 | +#define CONFIG_BOOTCOMMAND "run $modeboot" | ||
2004 | +#define CONFIG_BOOTDELAY 3 /* -1 to Disable autoboot */ | ||
2005 | +#define CONFIG_SYS_LOAD_ADDR 0 /* default? */ | ||
2006 | + | ||
2007 | +/* Keep L2 Cache Disabled */ | ||
2008 | +#define CONFIG_SYS_L2CACHE_OFF | ||
2009 | +#define CONFIG_SYS_CACHELINE_SIZE 32 | ||
2010 | + | ||
2011 | +/* Physical Memory map */ | ||
2012 | +#define CONFIG_NR_DRAM_BANKS 1 | ||
2013 | +#define PHYS_SDRAM_1 0 | ||
2014 | +#define CONFIG_SYS_TEXT_BASE 0x04000000 | ||
2015 | + | ||
2016 | +#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1 | ||
2017 | +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + \ | ||
2018 | + PHYS_SDRAM_1_SIZE - (16 * 1024 * 1024)) | ||
2019 | + | ||
2020 | +#define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000 | ||
2021 | +#define CONFIG_SYS_INIT_RAM_SIZE 0x1000 | ||
2022 | +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ | ||
2023 | + CONFIG_SYS_INIT_RAM_SIZE - \ | ||
2024 | + GENERATED_GBL_DATA_SIZE) | ||
2025 | + | ||
2026 | +/* Enable the PL to be downloaded */ | ||
2027 | +#define CONFIG_FPGA | ||
2028 | +#define CONFIG_FPGA_XILINX | ||
2029 | +#define CONFIG_FPGA_ZYNQPL | ||
2030 | +#define CONFIG_CMD_FPGA | ||
2031 | + | ||
2032 | +/* FIT support */ | ||
2033 | +#define CONFIG_FIT 1 | ||
2034 | +#define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */ | ||
2035 | + | ||
2036 | +#define CONFIG_CMD_BOOTZ | ||
2037 | +#undef CONFIG_BOOTM_NETBSD | ||
2038 | + | ||
2039 | +/* FIXME this should be removed pretty soon */ | ||
2040 | +#define XPSS_QSPI_BASEADDR 0xE000D000 | ||
2041 | +#define XPSS_NAND_BASEADDR 0xE1000000 | ||
2042 | +#define XPSS_CRTL_PARPORT_BASEADDR 0xE000E000 | ||
2043 | +#define SD_BASEADDR 0xE0100000 | ||
2044 | + | ||
2045 | +#endif /* __CONFIG_ZYNQ_COMMON_H */ | ||
2046 | diff --git a/include/configs/zynq_cseflash.h b/include/configs/zynq_cseflash.h | ||
2047 | new file mode 100644 | ||
2048 | index 0000000..495530e | ||
2049 | --- /dev/null | ||
2050 | +++ b/include/configs/zynq_cseflash.h | ||
2051 | @@ -0,0 +1,73 @@ | ||
2052 | +/* | ||
2053 | + */ | ||
2054 | + | ||
2055 | +#ifndef __CONFIG_H | ||
2056 | +#define __CONFIG_H | ||
2057 | + | ||
2058 | +#define PHYS_SDRAM_1_SIZE (256 * 1024 * 1024) | ||
2059 | + | ||
2060 | +#define CONFIG_ENV_IS_NOWHERE | ||
2061 | + | ||
2062 | +#include <configs/zynq_common.h> | ||
2063 | + | ||
2064 | +/* Disable uart console */ | ||
2065 | +#undef CONFIG_ZYNQ_SERIAL | ||
2066 | + | ||
2067 | + | ||
2068 | +#define CONFIG_ARM_DCC | ||
2069 | +#define CONFIG_CPU_V6 /* Required by CONFIG_ARM_DCC */ | ||
2070 | + | ||
2071 | +/* | ||
2072 | + * Open Firmware flat tree | ||
2073 | + */ | ||
2074 | +#undef CONFIG_OF_LIBFDT | ||
2075 | + | ||
2076 | + | ||
2077 | + | ||
2078 | + | ||
2079 | +#undef CONFIG_CMD_EDITENV | ||
2080 | +#undef CONFIG_CMD_SAVEENV | ||
2081 | + | ||
2082 | +#undef CONFIG_CMD_FPGA | ||
2083 | +#undef CONFIG_CMD_XIMG | ||
2084 | + | ||
2085 | +#undef CONFIG_CMD_LOADB /* loadb */ | ||
2086 | +#undef CONFIG_CMD_LOADS /* loads */ | ||
2087 | + | ||
2088 | +#define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */ | ||
2089 | + | ||
2090 | +#undef CONFIG_CMD_MISC /* Misc functions like sleep etc*/ | ||
2091 | +#undef CONFIG_CMD_RUN /* run command in env variable */ | ||
2092 | +#undef CONFIG_CMD_SOURCE /* "source" command support */ | ||
2093 | + | ||
2094 | +#undef CONFIG_CMD_BDI /* bdinfo */ | ||
2095 | +#undef CONFIG_CMD_BOOTD /* bootd */ | ||
2096 | +#undef CONFIG_CMD_CONSOLE /* coninfo */ | ||
2097 | +#undef CONFIG_CMD_ECHO /* echo arguments */ | ||
2098 | +#undef CONFIG_CMD_IMI /* iminfo */ | ||
2099 | +#undef CONFIG_CMD_ITEST /* Integer (and string) test */ | ||
2100 | +#undef CONFIG_CMD_IMLS /* List all found images */ | ||
2101 | + | ||
2102 | + | ||
2103 | +// FIXME this is silly - there is no any bootm image enabled - disable BOOTM | ||
2104 | +//#undef CONFIG_BOOTM_LINUX | ||
2105 | +#undef CONFIG_BOOTM_NETBSD | ||
2106 | +#undef CONFIG_BOOTM_RTEMS | ||
2107 | +#undef CONFIG_GZIP | ||
2108 | +#undef CONFIG_ZLIB | ||
2109 | + | ||
2110 | +#undef CONFIG_AUTO_COMPLETE | ||
2111 | +#define CONFIG_CMDLINE_EDITING | ||
2112 | +#undef CONFIG_SYS_LONGHELP | ||
2113 | + | ||
2114 | + | ||
2115 | +/* Because (at least at first) we're going to be loaded via JTAG_Tcl */ | ||
2116 | +#define CONFIG_SKIP_LOWLEVEL_INIT | ||
2117 | + | ||
2118 | + | ||
2119 | + | ||
2120 | +/* Why? */ | ||
2121 | +#undef CONFIG_ENV_SIZE | ||
2122 | +#define CONFIG_ENV_SIZE 896 | ||
2123 | + | ||
2124 | +#endif /* __CONFIG_H */ | ||
2125 | diff --git a/include/configs/zynq_zc70x.h b/include/configs/zynq_zc70x.h | ||
2126 | new file mode 100644 | ||
2127 | index 0000000..4e7df2e | ||
2128 | --- /dev/null | ||
2129 | +++ b/include/configs/zynq_zc70x.h | ||
2130 | @@ -0,0 +1,36 @@ | ||
2131 | +/* | ||
2132 | + * (C) Copyright 2012 Xilinx | ||
2133 | + * | ||
2134 | + * Configuration settings for the Xilinx Zynq ZC702 and ZC706 boards | ||
2135 | + * See zynq_common.h for Zynq common configs | ||
2136 | + * | ||
2137 | + * This program is free software; you can redistribute it and/or | ||
2138 | + * modify it under the terms of the GNU General Public License as | ||
2139 | + * published by the Free Software Foundation; either version 2 of | ||
2140 | + * the License, or (at your option) any later version. | ||
2141 | + * | ||
2142 | + * You should have received a copy of the GNU General Public License | ||
2143 | + * along with this program; if not, write to the Free Software | ||
2144 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2145 | + * MA 02111-1307 USA | ||
2146 | + */ | ||
2147 | + | ||
2148 | +#ifndef __CONFIG_ZYNQ_ZC70X_H | ||
2149 | +#define __CONFIG_ZYNQ_ZC70X_H | ||
2150 | + | ||
2151 | +#define PHYS_SDRAM_1_SIZE (1024 * 1024 * 1024) | ||
2152 | + | ||
2153 | +#define CONFIG_ZYNQ_SERIAL_UART1 | ||
2154 | +#define CONFIG_ZYNQ_GEM0 | ||
2155 | +#define CONFIG_PHY_ADDR 7 | ||
2156 | + | ||
2157 | +#define CONFIG_SYS_NO_FLASH | ||
2158 | + | ||
2159 | +#define CONFIG_MMC | ||
2160 | +#define CONFIG_ZYNQ_SPI | ||
2161 | +#define CONFIG_ZYNQ_I2C | ||
2162 | +#define CONFIG_ZYNQ_EEPROM | ||
2163 | + | ||
2164 | +#include <configs/zynq_common.h> | ||
2165 | + | ||
2166 | +#endif /* __CONFIG_ZYNQ_ZC70X_H */ | ||
2167 | diff --git a/include/configs/zynq_zc770.h b/include/configs/zynq_zc770.h | ||
2168 | new file mode 100644 | ||
2169 | index 0000000..3bfe631 | ||
2170 | --- /dev/null | ||
2171 | +++ b/include/configs/zynq_zc770.h | ||
2172 | @@ -0,0 +1,52 @@ | ||
2173 | +/* | ||
2174 | + * (C) Copyright 2012 Xilinx | ||
2175 | + * | ||
2176 | + * Configuration settings for the Xilinx Zynq ZC770 board. | ||
2177 | + * See zynq_common.h for Zynq common configs | ||
2178 | + * | ||
2179 | + * This program is free software; you can redistribute it and/or | ||
2180 | + * modify it under the terms of the GNU General Public License as | ||
2181 | + * published by the Free Software Foundation; either version 2 of | ||
2182 | + * the License, or (at your option) any later version. | ||
2183 | + * | ||
2184 | + * You should have received a copy of the GNU General Public License | ||
2185 | + * along with this program; if not, write to the Free Software | ||
2186 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2187 | + * MA 02111-1307 USA | ||
2188 | + */ | ||
2189 | + | ||
2190 | +#ifndef __CONFIG_ZYNQ_ZC770_H | ||
2191 | +#define __CONFIG_ZYNQ_ZC770_H | ||
2192 | + | ||
2193 | +#define PHYS_SDRAM_1_SIZE (1024 * 1024 * 1024) | ||
2194 | + | ||
2195 | +#define CONFIG_SYS_NO_FLASH | ||
2196 | + | ||
2197 | +#if defined(CONFIG_ZC770_XM010) | ||
2198 | +# define CONFIG_ZYNQ_SERIAL_UART1 | ||
2199 | +# define CONFIG_ZYNQ_GEM0 | ||
2200 | +# define CONFIG_PHY_ADDR 7 | ||
2201 | +# define CONFIG_MMC | ||
2202 | +# define CONFIG_ZYNQ_SPI | ||
2203 | + | ||
2204 | +#elif defined(CONFIG_ZC770_XM011) | ||
2205 | +# define CONFIG_ZYNQ_SERIAL_UART1 | ||
2206 | +# define CONFIG_NAND_ZYNQ | ||
2207 | + | ||
2208 | +#elif defined(CONFIG_ZC770_XM012) | ||
2209 | +# define CONFIG_ZYNQ_SERIAL_UART1 | ||
2210 | +# undef CONFIG_SYS_NO_FLASH | ||
2211 | + | ||
2212 | +#elif defined(CONFIG_ZC770_XM013) | ||
2213 | +# define CONFIG_ZYNQ_SERIAL_UART0 | ||
2214 | +# define CONFIG_ZYNQ_GEM1 | ||
2215 | +# define CONFIG_PHY_ADDR 7 | ||
2216 | +# define CONFIG_ZYNQ_SPI | ||
2217 | + | ||
2218 | +#else | ||
2219 | +# define CONFIG_ZYNQ_SERIAL_UART0 | ||
2220 | +#endif | ||
2221 | + | ||
2222 | +#include <configs/zynq_common.h> | ||
2223 | + | ||
2224 | +#endif /* __CONFIG_ZYNQ_ZC770_H */ | ||
2225 | diff --git a/include/configs/zynq_zed.h b/include/configs/zynq_zed.h | ||
2226 | new file mode 100644 | ||
2227 | index 0000000..b065ef7 | ||
2228 | --- /dev/null | ||
2229 | +++ b/include/configs/zynq_zed.h | ||
2230 | @@ -0,0 +1,34 @@ | ||
2231 | +/* | ||
2232 | + * (C) Copyright 2012 Xilinx | ||
2233 | + * | ||
2234 | + * Configuration for Zynq Evaluation and Development Board - ZedBoard | ||
2235 | + * See zynq_common.h for Zynq common configs | ||
2236 | + * | ||
2237 | + * This program is free software; you can redistribute it and/or | ||
2238 | + * modify it under the terms of the GNU General Public License as | ||
2239 | + * published by the Free Software Foundation; either version 2 of | ||
2240 | + * the License, or (at your option) any later version. | ||
2241 | + * | ||
2242 | + * You should have received a copy of the GNU General Public License | ||
2243 | + * along with this program; if not, write to the Free Software | ||
2244 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2245 | + * MA 02111-1307 USA | ||
2246 | + */ | ||
2247 | + | ||
2248 | +#ifndef __CONFIG_ZYNQ_ZED_H | ||
2249 | +#define __CONFIG_ZYNQ_ZED_H | ||
2250 | + | ||
2251 | +#define PHYS_SDRAM_1_SIZE (512 * 1024 * 1024) | ||
2252 | + | ||
2253 | +#define CONFIG_ZYNQ_SERIAL_UART1 | ||
2254 | +#define CONFIG_ZYNQ_GEM0 | ||
2255 | +#define CONFIG_PHY_ADDR 0 | ||
2256 | + | ||
2257 | +#define CONFIG_SYS_NO_FLASH | ||
2258 | + | ||
2259 | +#define CONFIG_MMC | ||
2260 | +#define CONFIG_ZYNQ_SPI | ||
2261 | + | ||
2262 | +#include <configs/zynq_common.h> | ||
2263 | + | ||
2264 | +#endif /* __CONFIG_ZYNQ_ZED_H */ | ||
2265 | diff --git a/include/zynqpl.h b/include/zynqpl.h | ||
2266 | new file mode 100644 | ||
2267 | index 0000000..c9629e1 | ||
2268 | --- /dev/null | ||
2269 | +++ b/include/zynqpl.h | ||
2270 | @@ -0,0 +1,60 @@ | ||
2271 | +/* | ||
2272 | + * (C) Copyright 2012 | ||
2273 | + * Joe Hershberger <joe.hershberger@ni.com> | ||
2274 | + * | ||
2275 | + * See file CREDITS for list of people who contributed to this | ||
2276 | + * project. | ||
2277 | + * | ||
2278 | + * This program is free software; you can redistribute it and/or | ||
2279 | + * modify it under the terms of the GNU General Public License as | ||
2280 | + * published by the Free Software Foundation; either version 2 of | ||
2281 | + * the License, or (at your option) any later version. | ||
2282 | + * | ||
2283 | + * This program is distributed in the hope that it will be useful, | ||
2284 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2285 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2286 | + * GNU General Public License for more details. | ||
2287 | + * | ||
2288 | + * You should have received a copy of the GNU General Public License | ||
2289 | + * along with this program; if not, write to the Free Software | ||
2290 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
2291 | + * MA 02111-1307 USA | ||
2292 | + * | ||
2293 | + */ | ||
2294 | + | ||
2295 | +#ifndef _ZYNQPL_H_ | ||
2296 | +#define _ZYNQPL_H_ | ||
2297 | + | ||
2298 | +#include <xilinx.h> | ||
2299 | + | ||
2300 | +extern int zynq_load(Xilinx_desc *desc, const void *image, size_t size); | ||
2301 | +extern int zynq_dump(Xilinx_desc *desc, const void *buf, size_t bsize); | ||
2302 | +extern int zynq_info(Xilinx_desc *desc); | ||
2303 | + | ||
2304 | +#define XILINX_ZYNQ_7010 0x2 | ||
2305 | +#define XILINX_ZYNQ_7020 0x7 | ||
2306 | +#define XILINX_ZYNQ_7030 0xc | ||
2307 | +#define XILINX_ZYNQ_7045 0x11 | ||
2308 | + | ||
2309 | +/* Device Image Sizes | ||
2310 | + *********************************************************************/ | ||
2311 | +#define XILINX_XC7Z010_SIZE 16669920/8 | ||
2312 | +#define XILINX_XC7Z020_SIZE 32364512/8 | ||
2313 | +#define XILINX_XC7Z030_SIZE 47839328/8 | ||
2314 | +#define XILINX_XC7Z045_SIZE 106571232/8 | ||
2315 | + | ||
2316 | +/* Descriptor Macros | ||
2317 | + *********************************************************************/ | ||
2318 | +#define XILINX_XC7Z010_DESC(cookie) \ | ||
2319 | +{ Xilinx_Zynq, devcfg, XILINX_XC7Z010_SIZE, NULL, cookie } | ||
2320 | + | ||
2321 | +#define XILINX_XC7Z020_DESC(cookie) \ | ||
2322 | +{ Xilinx_Zynq, devcfg, XILINX_XC7Z020_SIZE, NULL, cookie } | ||
2323 | + | ||
2324 | +#define XILINX_XC7Z030_DESC(cookie) \ | ||
2325 | +{ Xilinx_Zynq, devcfg, XILINX_XC7Z030_SIZE, NULL, cookie } | ||
2326 | + | ||
2327 | +#define XILINX_XC7Z045_DESC(cookie) \ | ||
2328 | +{ Xilinx_Zynq, devcfg, XILINX_XC7Z045_SIZE, NULL, cookie } | ||
2329 | + | ||
2330 | +#endif /* _ZYNQPL_H_ */ | ||
2331 | -- | ||
2332 | 1.7.5.4 | ||
2333 | |||
diff --git a/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend b/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend deleted file mode 100644 index 73363cab..00000000 --- a/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | # Include path to xilinx-v14.5 modifications to u-boot 2013.01.01 | ||
2 | FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:" | ||
3 | # Include path to patches to xilinx-v14.5 | ||
4 | FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot-xlnx:" | ||
5 | |||
6 | SRC_URI += "file://xilinx-v2013.01/0001-Xilinx-modifications-to-arch.patch \ | ||
7 | file://xilinx-v2013.01/0002-Xilinx-modifications-to-boards.patch \ | ||
8 | file://xilinx-v2013.01/0003-Xilinx-modifications-to-commmon.patch \ | ||
9 | file://xilinx-v2013.01/0004-Xilinx-modifications-to-drivers.patch \ | ||
10 | file://xilinx-v2013.01/0005-Xilinx-modifications-to-configs.patch \ | ||
11 | file://microblaze_bootm_Add_support_for_loading_initrd.patch \ | ||
12 | file://microblaze_bootm_Fix_coding_style_issues.patch \ | ||
13 | file://microblaze_Fix_coding_style_for_bootb.patch \ | ||
14 | " | ||
15 | include u-boot-extra.inc | ||