dsp.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #include <common.h>
  9. #include <post.h>
  10. #if CONFIG_POST & CONFIG_SYS_POST_DSP
  11. #include <asm/io.h>
  12. /* This test verifies DSP status bits in FPGA */
  13. DECLARE_GLOBAL_DATA_PTR;
  14. #define DSP_STATUS_REG 0xC4000008
  15. #define FPGA_STATUS_REG 0xC400000C
  16. int dsp_post_test(int flags)
  17. {
  18. uint old_value;
  19. uint read_value;
  20. int ret;
  21. /* momorize fpga status */
  22. old_value = in_be32((void *)FPGA_STATUS_REG);
  23. /* enable outputs */
  24. out_be32((void *)FPGA_STATUS_REG, 0x30);
  25. /* generate sync signal */
  26. out_be32((void *)DSP_STATUS_REG, 0x300);
  27. udelay(5);
  28. out_be32((void *)DSP_STATUS_REG, 0);
  29. udelay(500);
  30. /* read status */
  31. ret = 0;
  32. read_value = in_be32((void *)DSP_STATUS_REG) & 0x3;
  33. if (read_value != 0x03) {
  34. post_log("\nDSP status read %08X\n", read_value);
  35. ret = 1;
  36. }
  37. /* restore fpga status */
  38. out_be32((void *)FPGA_STATUS_REG, old_value);
  39. return ret;
  40. }
  41. #endif /* CONFIG_POST & CONFIG_SYS_POST_DSP */