keystone.c 1.1 KB

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