coherency_ll.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Coherency fabric: low level functions
  3. *
  4. * Copyright (C) 2012 Marvell
  5. *
  6. * Gregory CLEMENT <gregory.clement@free-electrons.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. *
  12. * This file implements the assembly function to add a CPU to the
  13. * coherency fabric. This function is called by each of the secondary
  14. * CPUs during their early boot in an SMP kernel, this why this
  15. * function have to callable from assembly. It can also be called by a
  16. * primary CPU from C code during its boot.
  17. */
  18. #include <linux/linkage.h>
  19. #define ARMADA_XP_CFB_CTL_REG_OFFSET 0x0
  20. #define ARMADA_XP_CFB_CFG_REG_OFFSET 0x4
  21. .text
  22. /*
  23. * r0: Coherency fabric base register address
  24. * r1: HW CPU id
  25. */
  26. ENTRY(ll_set_cpu_coherent)
  27. /* Create bit by cpu index */
  28. mov r3, #(1 << 24)
  29. lsl r1, r3, r1
  30. /* Add CPU to SMP group - Atomic */
  31. add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET
  32. ldr r2, [r3]
  33. orr r2, r2, r1
  34. str r2, [r3]
  35. /* Enable coherency on CPU - Atomic */
  36. add r3, r0, #ARMADA_XP_CFB_CFG_REG_OFFSET
  37. ldr r2, [r3]
  38. orr r2, r2, r1
  39. str r2, [r3]
  40. dsb
  41. mov r0, #0
  42. mov pc, lr
  43. ENDPROC(ll_set_cpu_coherent)