cm_init.S 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * MIPS Coherence Manager (CM) Initialisation
  4. *
  5. * Copyright (c) 2016 Imagination Technologies Ltd.
  6. */
  7. #include <asm/addrspace.h>
  8. #include <asm/asm.h>
  9. #include <asm/cm.h>
  10. #include <asm/mipsregs.h>
  11. #include <asm/regdef.h>
  12. LEAF(mips_cm_map)
  13. /* Config3 must exist for a CM to be present */
  14. mfc0 t0, CP0_CONFIG, 1
  15. bgez t0, 2f
  16. mfc0 t0, CP0_CONFIG, 2
  17. bgez t0, 2f
  18. /* Check Config3.CMGCR to determine CM presence */
  19. mfc0 t0, CP0_CONFIG, 3
  20. and t0, t0, MIPS_CONF3_CMGCR
  21. beqz t0, 2f
  22. /* Find the current physical GCR base address */
  23. 1: MFC0 t0, CP0_CMGCRBASE
  24. PTR_SLL t0, t0, 4
  25. /* If the GCRs are where we want, we're done */
  26. PTR_LI t1, CONFIG_MIPS_CM_BASE
  27. beq t0, t1, 2f
  28. /* Move the GCRs to our configured base address */
  29. PTR_LI t2, CKSEG1
  30. PTR_ADDU t0, t0, t2
  31. sw zero, GCR_BASE_UPPER(t0)
  32. sw t1, GCR_BASE(t0)
  33. /* Re-check the GCR base */
  34. b 1b
  35. 2: jr ra
  36. END(mips_cm_map)