Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / u-boot / post / board / lwmon5 / dsp.c
1 /*
2  * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com
3  *
4  * Developed for DENX Software Engineering GmbH
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <common.h>
10
11 #include <post.h>
12
13 #if CONFIG_POST & CONFIG_SYS_POST_DSP
14 #include <asm/io.h>
15
16 /* This test verifies DSP status bits in FPGA */
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 #define DSP_STATUS_REG          0xC4000008
21 #define FPGA_STATUS_REG         0xC400000C
22
23 int dsp_post_test(int flags)
24 {
25         uint   old_value;
26         uint   read_value;
27         int    ret;
28
29         /* momorize fpga status */
30         old_value = in_be32((void *)FPGA_STATUS_REG);
31         /* enable outputs */
32         out_be32((void *)FPGA_STATUS_REG, 0x30);
33
34         /* generate sync signal */
35         out_be32((void *)DSP_STATUS_REG, 0x300);
36         udelay(5);
37         out_be32((void *)DSP_STATUS_REG, 0);
38         udelay(500);
39
40         /* read status */
41         ret = 0;
42         read_value = in_be32((void *)DSP_STATUS_REG) & 0x3;
43         if (read_value != 0x03) {
44                 post_log("\nDSP status read %08X\n", read_value);
45                 ret = 1;
46         }
47
48         /* restore fpga status */
49         out_be32((void *)FPGA_STATUS_REG, old_value);
50
51         return ret;
52 }
53
54 #endif /* CONFIG_POST & CONFIG_SYS_POST_DSP */