pmb-fixed.c 913 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * arch/sh/mm/fixed_pmb.c
  3. *
  4. * Copyright (C) 2009 Renesas Solutions Corp.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/mm.h>
  12. #include <linux/io.h>
  13. #include <asm/mmu.h>
  14. #include <asm/mmu_context.h>
  15. static int __uses_jump_to_uncached fixed_pmb_init(void)
  16. {
  17. int i;
  18. unsigned long addr, data;
  19. jump_to_uncached();
  20. for (i = 0; i < PMB_ENTRY_MAX; i++) {
  21. addr = PMB_DATA + (i << PMB_E_SHIFT);
  22. data = ctrl_inl(addr);
  23. if (!(data & PMB_V))
  24. continue;
  25. if (data & PMB_C) {
  26. #if defined(CONFIG_CACHE_WRITETHROUGH)
  27. data |= PMB_WT;
  28. #elif defined(CONFIG_CACHE_WRITEBACK)
  29. data &= ~PMB_WT;
  30. #else
  31. data &= ~(PMB_C | PMB_WT);
  32. #endif
  33. }
  34. ctrl_outl(data, addr);
  35. }
  36. back_to_cached();
  37. return 0;
  38. }
  39. arch_initcall(fixed_pmb_init);