cpu.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <linux/module.h>
  2. #include <linux/io.h>
  3. #include "hardware.h"
  4. #include "common.h"
  5. unsigned int __mxc_cpu_type;
  6. EXPORT_SYMBOL(__mxc_cpu_type);
  7. static unsigned int imx_soc_revision;
  8. void mxc_set_cpu_type(unsigned int type)
  9. {
  10. __mxc_cpu_type = type;
  11. }
  12. void imx_set_soc_revision(unsigned int rev)
  13. {
  14. imx_soc_revision = rev;
  15. }
  16. unsigned int imx_get_soc_revision(void)
  17. {
  18. return imx_soc_revision;
  19. }
  20. void imx_print_silicon_rev(const char *cpu, int srev)
  21. {
  22. if (srev == IMX_CHIP_REVISION_UNKNOWN)
  23. pr_info("CPU identified as %s, unknown revision\n", cpu);
  24. else
  25. pr_info("CPU identified as %s, silicon rev %d.%d\n",
  26. cpu, (srev >> 4) & 0xf, srev & 0xf);
  27. }
  28. void __init imx_set_aips(void __iomem *base)
  29. {
  30. unsigned int reg;
  31. /*
  32. * Set all MPROTx to be non-bufferable, trusted for R/W,
  33. * not forced to user-mode.
  34. */
  35. __raw_writel(0x77777777, base + 0x0);
  36. __raw_writel(0x77777777, base + 0x4);
  37. /*
  38. * Set all OPACRx to be non-bufferable, to not require
  39. * supervisor privilege level for access, allow for
  40. * write access and untrusted master access.
  41. */
  42. __raw_writel(0x0, base + 0x40);
  43. __raw_writel(0x0, base + 0x44);
  44. __raw_writel(0x0, base + 0x48);
  45. __raw_writel(0x0, base + 0x4C);
  46. reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
  47. __raw_writel(reg, base + 0x50);
  48. }