2008-02-04 13:10:42 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com
|
|
|
|
*
|
|
|
|
* Developed for DENX Software Engineering GmbH
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2008-02-04 13:10:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
|
|
|
#include <post.h>
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if CONFIG_POST & CONFIG_SYS_POST_DSP
|
2008-02-04 13:10:42 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
/* This test verifies DSP status bits in FPGA */
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2010-08-19 07:38:56 +00:00
|
|
|
#define DSP_STATUS_REG 0xC4000008
|
|
|
|
#define FPGA_STATUS_REG 0xC400000C
|
2008-02-04 13:10:42 +00:00
|
|
|
|
|
|
|
int dsp_post_test(int flags)
|
|
|
|
{
|
2010-08-19 07:38:56 +00:00
|
|
|
uint old_value;
|
2008-02-04 13:10:42 +00:00
|
|
|
uint read_value;
|
|
|
|
int ret;
|
|
|
|
|
2010-08-19 07:38:56 +00:00
|
|
|
/* momorize fpga status */
|
|
|
|
old_value = in_be32((void *)FPGA_STATUS_REG);
|
|
|
|
/* enable outputs */
|
|
|
|
out_be32((void *)FPGA_STATUS_REG, 0x30);
|
|
|
|
|
|
|
|
/* generate sync signal */
|
|
|
|
out_be32((void *)DSP_STATUS_REG, 0x300);
|
|
|
|
udelay(5);
|
|
|
|
out_be32((void *)DSP_STATUS_REG, 0);
|
|
|
|
udelay(500);
|
|
|
|
|
|
|
|
/* read status */
|
2008-02-04 13:10:42 +00:00
|
|
|
ret = 0;
|
|
|
|
read_value = in_be32((void *)DSP_STATUS_REG) & 0x3;
|
2010-08-19 07:38:56 +00:00
|
|
|
if (read_value != 0x03) {
|
2008-02-04 13:10:42 +00:00
|
|
|
post_log("\nDSP status read %08X\n", read_value);
|
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
|
2010-08-19 07:38:56 +00:00
|
|
|
/* restore fpga status */
|
|
|
|
out_be32((void *)FPGA_STATUS_REG, old_value);
|
|
|
|
|
2008-02-04 13:10:42 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#endif /* CONFIG_POST & CONFIG_SYS_POST_DSP */
|