keystone.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Keystone EVM : Board initialization
  4. *
  5. * (C) Copyright 2014
  6. * Texas Instruments Incorporated, <www.ti.com>
  7. */
  8. #include <common.h>
  9. #include <init.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/psc_defs.h>
  12. #include <asm/arch/hardware.h>
  13. /**
  14. * cpu_to_bus - swap bytes of the 32-bit data if the device is BE
  15. * @ptr - array of data
  16. * @length - lenght of data array
  17. */
  18. int cpu_to_bus(u32 *ptr, u32 length)
  19. {
  20. u32 i;
  21. if (!(readl(KS2_DEVSTAT) & 0x1))
  22. for (i = 0; i < length; i++, ptr++)
  23. *ptr = cpu_to_be32(*ptr);
  24. return 0;
  25. }
  26. static void turn_off_all_dsps(int num_dsps)
  27. {
  28. int i;
  29. for (i = 0; i < num_dsps; i++) {
  30. if (psc_disable_module(i + KS2_LPSC_GEM_0))
  31. printf("Cannot disable module for #%d DSP", i);
  32. if (psc_disable_domain(i + KS2_GEM_0_PWR_DOMAIN))
  33. printf("Cannot disable domain for #%d DSP", i);
  34. }
  35. }
  36. int misc_init_r(void)
  37. {
  38. char *env;
  39. long ks2_debug = 0;
  40. env = env_get("ks2_debug");
  41. if (env)
  42. ks2_debug = simple_strtol(env, NULL, 0);
  43. if ((ks2_debug & DBG_LEAVE_DSPS_ON) == 0)
  44. turn_off_all_dsps(KS2_NUM_DSPS);
  45. return 0;
  46. }