keystone.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <asm/io.h>
  10. #include <asm/arch/psc_defs.h>
  11. #include <asm/arch/hardware.h>
  12. /**
  13. * cpu_to_bus - swap bytes of the 32-bit data if the device is BE
  14. * @ptr - array of data
  15. * @length - lenght of data array
  16. */
  17. int cpu_to_bus(u32 *ptr, u32 length)
  18. {
  19. u32 i;
  20. if (!(readl(KS2_DEVSTAT) & 0x1))
  21. for (i = 0; i < length; i++, ptr++)
  22. *ptr = cpu_to_be32(*ptr);
  23. return 0;
  24. }
  25. static void turn_off_all_dsps(int num_dsps)
  26. {
  27. int i;
  28. for (i = 0; i < num_dsps; i++) {
  29. if (psc_disable_module(i + KS2_LPSC_GEM_0))
  30. printf("Cannot disable module for #%d DSP", i);
  31. if (psc_disable_domain(i + KS2_GEM_0_PWR_DOMAIN))
  32. printf("Cannot disable domain for #%d DSP", i);
  33. }
  34. }
  35. int misc_init_r(void)
  36. {
  37. char *env;
  38. long ks2_debug = 0;
  39. env = env_get("ks2_debug");
  40. if (env)
  41. ks2_debug = simple_strtol(env, NULL, 0);
  42. if ((ks2_debug & DBG_LEAVE_DSPS_ON) == 0)
  43. turn_off_all_dsps(KS2_NUM_DSPS);
  44. return 0;
  45. }