This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem disabling cache on ARM926ej-s

  • Note: This was originally posted on 16th March 2011 at http://forums.arm.com

    > Are you marking memory as write-back cacheable?

    Yes.

    > If so, you should be cleaning the D cache as well as invalidating it.



    disablecache: mrc p15, 0, r15, c7, c14, 3 @ test, clean and invalidate
                    bne disablecache

                    mov r0,#0                 @ drain write buffer
                    mcr p15, 0, r0, c7, c10, 4

    @@@@            mcr p15, 0, r0, c7, c6, 0    @ invalidate dcache

                    mrc p15, 0, r0, c1, c0, 0    @ Disable Icache(12), Dcache(2) and MMU(0)
                    bic r0, r0, #4096
                    bic r0, r0, #5
                    mcr p15, 0, r0, c1, c0, 0

                    mov pc,lr                 @ return to SWI handler




    Like this, in that order?




    > Is the memory flat mapped?

    Yes
  • Note: This was originally posted on 17th March 2011 at http://forums.arm.com

    Or maybe like this (please answer)






    disablecache:    mov r0,#0                 @ drain write buffer
               mcr p15, 0, r0, c7, c10, 4

               mrc p15, 0, r15, c7, c14, 3  @ test, clean and invalidate
               bne disablecache

    @@@@            mcr p15, 0, r0, c7, c6, 0    @ invalidate dcache

               mrc p15, 0, r0, c1, c0, 0    @ Disable Icache(12), Dcache(2) and MMU(0)
               bic r0, r0, #4096
               bic r0, r0, #5
               mcr p15, 0, r0, c1, c0, 0

               mov pc,lr                 @ return to SWI handler







    What about those NOPs or delays I see in some sources after accessing CP15?

  • Note: This was originally posted on 17th March 2011 at http://forums.arm.com

    I've copied (almost) this from linux, and it still doesn't work.



    disablecache:   mrc p15, 0, r15, c7, c14, 3  @ test, clean and invalidate
                    bne DisableCache

                    mov r0,#0
                    mcr p15, 0, r0, c7, c5, 0    @ invalidate I cache
                    mcr p15, 0, r0, c7, c10, 4      @ drain write buffer

                    mrc p15, 0, r0, c1, c0, 0    @ Disable Icache(12), Dcache(2) and MMU(0)
                    bic r0, r0, #4096
                    bic r0, r0, #5
                    mcr p15, 0, r0, c1, c0, 0

                    mov pc,lr
  • Note: This was originally posted on 17th March 2011 at http://forums.arm.com

    Got it!

    "bne DisableCache" should be "bne disablecache"
  • Note: This was originally posted on 16th March 2011 at http://forums.arm.com

    Are you marking memory as write-back cacheable?  If so, you should be cleaning the D cache as well as invalidating it.

    Is the memory flat mapped?