cache-l2x0.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2009-2010 Pengutronix
  3. * Sascha Hauer <s.hauer@pengutronix.de>
  4. * Juergen Beisert <j.beisert@pengutronix.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it under
  7. * the terms of the GNU General Public License version 2 as published by the
  8. * Free Software Foundation.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/err.h>
  12. #include <linux/kernel.h>
  13. #include <asm/hardware/cache-l2x0.h>
  14. #include <mach/hardware.h>
  15. static int mxc_init_l2x0(void)
  16. {
  17. void __iomem *l2x0_base;
  18. void __iomem *clkctl_base;
  19. if (!cpu_is_mx31() && !cpu_is_mx35())
  20. return 0;
  21. /*
  22. * First of all, we must repair broken chip settings. There are some
  23. * i.MX35 CPUs in the wild, comming with bogus L2 cache settings. These
  24. * misconfigured CPUs will run amok immediately when the L2 cache gets enabled.
  25. * Workaraound is to setup the correct register setting prior enabling the
  26. * L2 cache. This should not hurt already working CPUs, as they are using the
  27. * same value.
  28. */
  29. #define L2_MEM_VAL 0x10
  30. clkctl_base = ioremap(MX35_CLKCTL_BASE_ADDR, 4096);
  31. if (clkctl_base != NULL) {
  32. writel(0x00000515, clkctl_base + L2_MEM_VAL);
  33. iounmap(clkctl_base);
  34. } else {
  35. pr_err("L2 cache: Cannot fix timing. Trying to continue without\n");
  36. }
  37. l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096);
  38. if (IS_ERR(l2x0_base)) {
  39. printk(KERN_ERR "remapping L2 cache area failed with %ld\n",
  40. PTR_ERR(l2x0_base));
  41. return 0;
  42. }
  43. l2x0_init(l2x0_base, 0x00030024, 0x00000000);
  44. return 0;
  45. }
  46. arch_initcall(mxc_init_l2x0);